Home Tutorials Forums Articles Blogs Movies Library Employment Press
By Ruben Swieringa
|
Published

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


7 Responses to "Colin Moock on Actionscript 4 (FITC Amsterdam 2008)"

 
Xegnma
said this on 15 Feb 2009 1:23:28 PM CDT
Any word on private constructors?

 
Ruben ( Author/Admin)
said this on 15 Feb 2009 2:09:11 PM CDT
Hey Xegnma, no I don't think he mentioned anything about private constructors, anyway, ecmascript3 is dead now, so doesn't matter anymore ;)

 
John Isaacks
said this on 02 Mar 2009 6:27:10 PM CDT
What about multiple inheritance?

 
UncleNinja
said this on 23 May 2009 3:52:03 PM CDT
Oooh! This all sounds wonderful. The fact that you can change data types on a variable is pretty deadgum cool! :P

 
Aaron
said this on 03 Apr 2010 9:57:07 PM CDT
"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."

I don't get this. Why can't a simple quote be used as now and just allow string literals to contain linebreaks?

 
Cassie
said this on 18 Jun 2011 11:44:24 PM CDT
In awe of that answer! Ralely cool!

 
Samuel Asher Rivello
said this on 22 Feb 2012 6:33:12 PM CDT
An official Adobe Roadmap hints at new language features.

ActionScript 4.0 Revealed

www.rivellomultimediaconsulting.com/actionscript-4-revealed/




Leave a reply:
Your Name *: Email (private) *: Website:
Please copy the characters from the image below into the text field below. Doing this helps us prevent automated submissions.
Security Code: img

Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.