Categories
Featured jobs
» More ActionScript, Flash and Flex jobs.
» Advertise a job for free
Our network
Advertisement

 »  Home  »  Blogs  »  Colin Moock on Actionscript 4 (FITC Amsterdam 2008)
Ruben Swieringa
Colin Moock on Actionscript 4 (FITC Amsterdam 2008)
By Ruben Swieringa | Published  03/5/2008

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

Post a comment about this blog
Add comment
Comments



Search Entire Site
Add to Google
Advertisements
Latest New Articles
Set up a simple IIS Server for Flash
by Peter McBride

Day 1 at FITC Toronto 2008
by Anthony Pace

Simple reflection effect with AS2
by Jean André Mas

ActionScript.org Meets Josh Tynjala (aka dr_zeus)
by ActionScript.org Staff

Rapidly Create Online Flash Movies to Help Users Market, Sell and Support Software and Hardware
by Sabrina F

mailing list
Enter your email address:
mailing list
Subscribe Unsubscribe
© 2000-2007 actionscript.org! All Rights Reserved.
Read our Privacy Statement and Terms of Use...
Our dedicated server is hosted and managed by WebScorpion Webhosting.