This is from Dartlang spec 0.07 and i brought this gtext to my blog for to be able to analyze this when i am travelling and cant use my computer. So; DART EasyToUse with Mobile.
Variables
Variables are storage locations in memory.
variableDeclaration:
declaredIdentifier (',' identifier)*
;
initializedVariableDeclaration:
declaredIdentifier ('=' expression)? (',' initializedIdentifier)*
;
initializedIdentifierList:
initializedIdentifier (',' initializedIdentifier)*
;
initializedIdentifier:
identifier ('=' expression)?
;
declaredIdentifier:
finalVarOrType identifier
;
finalVarOrType:
final type?
| var
| type
;
A variable that has not been initialized has the initial value null.
A final variable is a variable whose declaration includes the modifier final. A final variable can only be assigned once, when it is initialized, or a compile-time error occurs.
A static variable is a variable that is not associated with a particular instance, but rather with an entire library or class.
A variable that is marked both static and final must be initialized to a compile-time constant or a compile-time error occurs.
Why tie together two orthogonal concepts like static and final by requiring the use of constants? Because we do not want a language where one tends to define expensive initialization computations, causing long application startup times. This is especially crucial for Dart, which is designed for coding client applications.
One time initializations using constants should incur negligible cost at run time.
If a variable declaration does not explicitly specify a type, the type of the declared variable(s) is Dynamic, the unknown type.
A top-level variable is implicitly static. It is a compile-time error to preface a top level variable declaration with the built-in identifier static. It is a compile-time error if a top level variable is initialized with an expression that is not a compile-time constant.
So this was it, directly from Dartlang spec 0.07.
Notes come here soon:
Ei kommentteja:
Lähetä kommentti