Ajaxian has posted a set of slides from Brendan Eich on the future of JavaScript. As you probably know, we have been tracking the ECMAScript Edition 4 spec very closely in our implementation of ActionScript 3, so many of the concepts will be familiar to you. Because of timing, there are proposals in the new version of the language that are not going into ActionScript 3.

The ones the I’m particularly excited about are:

Parametric types (otherwise known as generics)

let blocks (removed after more careful reading)

yield

Are there any ideas in this slide deck that you would like to see in — dare I say it — ActionScript 4?

13 Responses to “Brendan Eich on JavaScript 2”

Thanks, Sho. I had been curious about that phrase “JavaScript 2″… is that a Mozilla brandname, with the actual reference spec being ECMAScript 4? The top search hit I found for the phrase was a 2003 document which sounded somewhat different: http://www.mozilla.org/js/language/js20/

I actually misread Brendan’s slides, and I mistook one of his examples of the let block syntax to be something like lambda expressions or Ruby’s block syntax. Upon re-reading it, I wonder if it wouldn’t just be better to redefine the behavior of var and deal with backward compatibility through a flag. Yield and generics are still exciting to me.

Nullable (and non-nullable) types are interesting to me, but I haven’t fully thought through the implications. When would I want a nullable number?

Decimals are a clear win.

Array comprehensions would be more interesting to me if they were lazy evaluated (like list comprehensions).

I’m gonna do a shameless plug :)
The haXe language already has Generics and Structural types (signatures). But also Enums (variants) and type inference. It target the Flash Player 6 7 8 and soon 9, but can also be used to write Javascript/AJAX applications and Server side with database access. haXe.org to visit the website ;)

Sho, I know this is a late comment but Till makes me want to respond. :-)

Overloading is a def need. I really desired it in AS 3 but, as we know, it isn’t there. In C#, overloading makes code soooo much better. Instead of writing a method and running through the arguments array to see what was passed in you can write multiple methods with different arguments for each scenario. This works GREAT for constructors (c# code here):

Its like you read my mind! You appear to know so much about this, like you wrote the book in it or
something. I think that you could do with a few pics to drive the message home a
bit, but instead of that, this is wonderful blog.
A great read. I will certainly be back.