The Dart Programming Language by Gilad Bracha
Author:Gilad Bracha [Bracha, Gilad]
Language: eng
Format: epub, azw3
Publisher: Pearson Education
Published: 2015-12-06T23:00:00+00:00
We can write
var l = new List<String>();
l is List<String>; // true
l is List<int>; // false
One must understand the limitations of such tests in Dart however. Because the type system is unsound there is no hard guarantee that an object that claims to be, say, a List<int> contains only integers. We can be confident that the object is a list, and that it was created as a list of integers. However, any kind of object could subsequently have been inserted into it.
In checked mode however, we have a lot more confidence. Any attempt to corrupt the list by inserting an inappropriate object into it would be trapped in checked mode. Checked mode tests the actual type of objects against the declared types of variables and function results; but in a generic type, the actual type arguments to the generic are substituted for any type variables in the declared types. So, given that List defines
operator [int index]= (E e)
when one writes
Click here to view code image
var l = new List<String>();
l[0] = 'abc'; // always ok
l[1] = 42; // fails in checked mode - 42 is an int which is not a subtype of String
checked mode will ensure that uses of an instance of a generic class cannot be corrupted.
Download
The Dart Programming Language by Gilad Bracha.azw3
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Angular for Enterprise-Ready Web Applications by Doguhan Uluca(2217)
Teaching with Google Classroom by Michael Zhang(1292)
Learn TypeScript 3 by Building Web Applications by Sebastien Dubois(1246)
Refactoring TypeScript by James Hickey(1177)
Professional JavaScript by Philip Kirkbride & Vinicius Isola & Siyuan Gao & Hugo Di Francesco(916)
Professional JavaScript for Web Developers by Matt Frisbie(823)
Interactive Data Visualization for the Web by Scott Murray(758)
Data Structures and Algorithms with JavaScript by Michael McMillan(672)
Node.js Design Patterns by Mario Casciaro && Luciano Mammino(634)
PHP, MySQL, & JavaScript All-in-One For Dummies by Richard Blum(583)
Mastering JavaFX 8 Controls by Ebbers Hendrik(582)
JavaScript For Kids For Dummies by Chris Minnick & Eva Holland(575)
Automating System Administration with Perl by David N. Blank-Edelman(548)
JavaScript and JQuery: Interactive Front-End Web Development by Jon Duckett(526)
React Native Blueprints by Emilio Rodriguez Martinez(500)
The Road to GraphQL by Robin Wieruch(483)
JavaScript and AJAX For Dummies by Andy Harris(481)
AWS Lambda in Action: Event-driven serverless applications by Danilo Poccia(477)
Node.js for Embedded Systems by Patrick Mulder(474)
