Last week at FITC Amsterdam I attended Colin Moock's session about the next version of ECMAScript. As ECMAScript is the language standard on which Actionscript is (somewhat loosely) based, this means that most proposed features for ECMAScript 4.0 will also be in Actionscript 4.0 (hence the name "Actionscript 4??"). Do note that most of the proposals are still just that.
Here's a quick summary:
Record type - The record type is like a light-weight class and lets you define a set of properties that any variable of that type should have.
Array type - The array type lets you specify the allowed datatypes for values in your array, in a semi-indexspecific way:
type someArray = [boolean, int, string];
This also goes for rest-argument arrays in method-signiatures, which is hellacool.
Union types - ECMAScript 4 allows you to specify multiple allowed datatypes for a property, return-type, etc:
var n:(int|uint)
Nullable & non-nullable types - With the ? and ! characters you can (respectively) allow or keep variables from carrying null-values. The same goes for classes.
Lexical block scoping - ..gives you just a little more power over the scope to which your variables and functions are local. Just surround the required scope with accolades ( { and } ) and declare your variable with 'let' instead of 'var'.
One-line methods - Lets you declare write a function in pretty much the same way as you would a one-line if-statement.
||= - Easy for assigning default-values:
iDontWantToBeNull ||= "not null" // value is only assigned if var is null
Method overloading! - Hooray. Yeah.
..use the generic keyword.
Operator overloading - Useful if you would want to have + (the plus-operator) perform a concat-operation when executed upon arrays.
cast-operator - As in AS3 there's still a difference between the as-operator and the oldskool-way of casting (MyClass(myVar)), the cast-operator will be introduced to replace the latter.
Datatype switching - ECMAScript 4 will allow for variables their datatypes to be evaluated through a switch-statement, which is kinda cool.
Multiline strings - Putting three double-quotes at the start and end of your string will allow you to have it spawn multiple lines, you also won't have to escape any double-quotes you have in your triple-quoted string.
.
For those of you interested, here's the online version of Colin's presentation:
moock.org/lectures/newInECMAScript4
Spread The Word
4 Responses to "Colin Moock on Actionscript 4 (FITC Amsterdam 2008)" 
|
said this on 15 Feb 2009 1:23:28 PM CDT
Any word on private const
|
|
said this on 15 Feb 2009 2:09:11 PM CDT
Hey Xegnma, no I don't th
|
|
said this on 02 Mar 2009 6:27:10 PM CDT
What about multiple inher
|
|
said this on 23 May 2009 3:52:03 PM CDT
Oooh! This all sounds won
|
Author/Admin)