Brendan Eich on JavaScript 2

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”

  1. John Dowdell

    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/

    tx, jd

  2. sho

    That’s right. When folks from Mozilla say “JavaScript 2”, they mean “the new version of the language we are going to put into the browser which is based on ECMAScript Edition 4”.

  3. Till Schneidereit

    Hi Sho,

    Although the enhancements you mention are really exciting, I’d consider the following ones more important:
    – Structural types
    – Nullable types
    – Decimal type and the associated math

    Also, the following enhancements make for really nice syntactic sugar:
    – Array comprehensions
    – Operator overloading

  4. Sho

    Good picks, Till!

    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).

    Operator overloading is great and scary at the same time.

    Thanks for the input!

  5. sho

    One more question… What’s your interest in structural types? How would you imagine using it?


  6. Nicolas

    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 ;)

  7. sho

    Cool, Nicolas. I haven’t played around with haXe yet (how do you prounounce this?) but I am familiar with MTASC, which is great work. I’m looking forward to seeing how haXe evolves.

  8. John C. Bland II

    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):

    public Table(string name, string schema, List columns)
    this._name = name;
    this._schema = schema;
    this._columns = columns;

    public Table(string name, string schema, bool hasView, List columns, List viewColumns) : this(name, schema, columns)
    this._hasView = hasView;
    this._viewColumns = viewColumns;

    That kind of stuff would make AS 4 super sweet. Another thing I’d love to see is something like this (sample AS code):

    public function blah(myvar:String[]){


    This way we expect a string of arrays in myvar vs the need to create a custom type.

    Anyways, I haven’t dove head-first into AS 3 but I will def’ say it is growing up right before our eyes. :-)

  9. sho

    Great comments, John. Fortunately, I think you and Till may actually agree, since I think he was referring to operator overloading, not method overloading.

    Operator overloading lets you redefine operators like ‘+’ and ‘=’. In some cases, it can really help, but on the whole, it has some potential for abuse.

  10. Wonders for Oyarsa

    Operator overloading is a Godsend for things like Vector and Matrix math. I don’t suppose there is a way of curbing the abuses?

  11. printable coupons for suave cocoa butter lotion

    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.

  12. clash of clans hack download no survey mac

    Ridiculous quest there. What occurred after? Goodd luck!

  13. HarryFains

    Вы когда-нибудь мечтали похудеть?
    Вы интересуетесь, как это сделать?
    Вы может быть сомневаетесь в своих возможностях?
    У нас есть проверенное средство, как похудеть легко, быстро и навсегда!
    Узнайте подробности: как похудеть на 5 кг в домашних условиях

Leave a Reply