Slashdot Mirror


ECMAScript 6 Is Officially a JavaScript Standard

rjmarvin writes: The ECMAScript 6 specification is now a standard. ES6 is the first major revision to the programming language since 1999 and its hallmark features include a revamped syntax featuring classes and modules. The Ecma General Assembly officially approved the specification at its June meeting in France, ECMAScript project editor Allen Wirfs-Brock announced.

41 of 80 comments (clear)

  1. Yay! by sribe · · Score: 2

    This really marks the triumph of the newish and competent committee over the prior boneheads who wasted years trying to shove XHTML down our throats while adding features that were so poorly designed as to be nearly worthless. (ES5 marked the transition, the first cleanup after the prior mess, and ES7 will finally get us to where the language should have been 10+ years ago if not for all the time wasted by wankers with no clue about actual software development.)

    1. Re:Yay! by Anonymous Coward · · Score: 2, Interesting

      How dare people want you to actually close tags and use consistent casing!

    2. Re:Yay! by ShanghaiBill · · Score: 3, Informative

      What kind of features were worthless?

      Semicolon insertion.
      Idiotic scoping rules.
      Bad handling of NaN and null.
      Hidden prototype items in arrays/objects.
      "with" statement.
      "==" not working like "===".
      "void"

      Many more listed here: Bad parts
      And here: Awful parts

    3. Re:Yay! by jaklode · · Score: 1

      HTML is unlogical.

    4. Re:Yay! by ShanghaiBill · · Score: 1

      To be fair IEEE 754 (Or IEC 60559 to be more precise.) have plenty of flaws

      Yes, it has flaws, but it also has one ENORMOUS advantage: it is implemented in hardware on almost any computer doing JavaScript. Complaining about IEEE 754 rounding rules is silly, because that is not at all a problem specific to JavaScript. Crockford also complains about bitwise operators and the increment operator (++). Bitwise operators are often indispensable, and ++ is obvious and idiomatic to anyone used to C/C++/Java/Perl or any of many, many other languages.

  2. So that means in ten years we can use it right? by dmgxmichael · · Score: 4, Insightful

    I hate how legacy browsers act as stones around our necks.

    1. Re:So that means in ten years we can use it right? by SecretSquirrel33 · · Score: 1

      Yes, yes you can use it now: https://babeljs.io/

  3. Great by ArcadeMan · · Score: 1

    How long until we can actually use it? How long until Chrome, Edge, Firefox, Opera and Safari supports it on all their respective supported platforms?

    1. Re:Great by Carewolf · · Score: 1

      How long until we can actually use it? How long until Chrome, Edge, Firefox, Opera and Safari supports it on all their respective supported platforms?

      Considering it used to be Mozilla only project, I think they already have most of it. As for the rest: They will probably never get it for the same reason it was never default available in Firefox: It is not backwards compatible (unless they fixed that sometime the last 5 years).

    2. Re:Great by ChunderDownunder · · Score: 2

      Pretty quickly. The Browser Wars are over; Chrome won.

      (posted from iceweasel)

    3. Re:Great by monkeyxpress · · Score: 1

      I haven't checked the standard in detail, but I imagine an ES6 to ES5 compiler will come out pretty quickly. Even if this only supports the core features to start with people will be able to start migrating towards ES6 code as soon as that happens. Most of the benefits appear to be in program structure rather than performance, so native platform support isn't actually that important.

    4. Re:Great by imatter · · Score: 1

      Nail that man's foot to the deck.

    5. Re:Great by jopsen · · Score: 1

      How long until we can actually use it? How long until Chrome, Edge, Firefox, Opera and Safari supports it on all their respective supported platforms?

      Compile w. babeljs.io for now... But Chrome and Firefox will probably have support relatively soon. FF has had much of ES6 internally for years.

  4. Here is an answer (sort of) by DumbSwede · · Score: 2

    Seems it will roll out peicmeal like other HTML JavaScript enhancements in the past

    A quick google turned up this useful link.

    Browser Compatibility

    With many browsers you can use many features now (but not all).

    1. Re:Here is an answer (sort of) by dave420 · · Score: 1

      Off-topic, but your open letter to Iran is factually inaccurate. Apostasy is not a criminal offence in Iran. You might want to update your rant to reflect that.

  5. So it was approved in France? by Viol8 · · Score: 1

    That means there must be some new error syntax to emulate a gallic shrug and some vague hand waving. A much nicer alternative to a a meaningless number or some unfriendly message.

    1. Re:So it was approved in France? by dave420 · · Score: 2

      Whereas if it was approved in the US it would be covered in bacon grease and shoot up a church! Lazy stereotypes are fun!

  6. What's in Javascript 6? by Anonymous Coward · · Score: 5, Informative

    Good overview here: http://es6-features.org

    The big one is real classes. No more prototype boilerplate.

    1. Re:What's in Javascript 6? by UnknownSoldier · · Score: 1

      > No more prototype boilerplate

      Definitely a nice touch but not mandatory. Using anonymous closures isn't THAT hard to do with inheritance with.

      The nice thing about classes in Section 14.5 is this note:

      NOTE: A ClassBody is always strict code.

      Now if they could only clean up the rest of the crappy language. At least it's a start.

  7. Spec by TFlan91 · · Score: 4, Informative

    Since actually having a link to the spec in the announcement of the spec would be helpful...

    http://www.ecma-international....

  8. Doesn't Matter by mrun4982 · · Score: 1

    Since we won't be able to use it for at least another 10 years.

  9. How long until rollouts... by mark-t · · Score: 1

    For myself, in particular, I wonder how long it will take v8 to support it.

  10. Wow, they got modules before C++ by UnknownSoldier · · Score: 2

    Surprised they got modules so quickly. Someday modules will eventually make it into C++ ...

    * 2006 http://www.open-std.org/jtc1/s...
    * 2014 http://www.open-std.org/jtc1/s...
    * 2015 http://www.open-std.org/JTC1/S...
    * 2015 (April) https://isocpp.org/files/paper...
    * http://www.infoq.com/news/2015...
    * http://stackoverflow.com/quest...

    I see the "use strict" HACK is still optional ("An ECMAScript Script syntactic unit may be processed using either unrestricted or strict mode syntax and semantics. ") but at least in the case of a class is mandatory ("A ClassBody is always strict code.") Someday Javascript will stop being a shitty language. Sadly it won't be this year ... :-/

  11. Re: So that means in ten years we can use it right by Anonymous Coward · · Score: 1

    Why not replace the www with a proprietary binary format

    Exactly.

  12. Prototypical by nmb3000 · · Score: 4, Informative

    revamped syntax featuring classes

    So they just gave up on the whole prototype system and duct taped class-based OO on top of it? That's actually kind of sad -- It was a special aspect of Javascript that set it apart from other languages, and homogenization is boring. I guess maybe today's "Javascript developers" just couldn't wrap their heads around it.

    Here's a rundown of the new features if anyone else hasn't been following ES6 and is curious. A few of note are

    scoped and const declaration via let and const,
    lazy iterators and generators,
    format/heredoc strings,
    and varargs ala Lua.

    Overall this looks like a good step in bringing Javascript closer to being on par with more modern languages.

    --
    "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
    /)
    1. Re:Prototypical by SirAnodos · · Score: 3, Insightful

      So they just gave up on the whole prototype system and duct taped class-based OO on top of it? That's actually kind of sad -- It was a special aspect of Javascript that set it apart from other languages, and homogenization is boring. I guess maybe today's "Javascript developers" just couldn't wrap their heads around it.

      They did not give up on the prototype system. To quote from the link you shared:

      ES6 classes are a simple sugar over the prototype-based OO pattern... Classes support prototype-based inheritance, super calls, instance and static methods and constructors.

      It's just sugar. It's all prototype inheritance underneath the sugar, and you are still free to not use the sugar and keep using prototype inheritance like you always have.

    2. Re:Prototypical by Kjella · · Score: 1

      So they just gave up on the whole prototype system and duct taped class-based OO on top of it? That's actually kind of sad -- It was a special aspect of Javascript that set it apart from other languages, and homogenization is boring. I guess maybe today's "Javascript developers" just couldn't wrap their heads around it.

      And a very frustrating aspect for all the developers familiar with C# / ObjectiveC / Swift / C++ / Java / VB whose job it was to port traditional applications to be web applications. And YMMV but in my experience object oriented programming is a pretty good model for GUI front-ends, all the windows and dialogs with their menus, toolbars, buttons and so on have a ton of state and fire events like a button saying "I just got clicked" or a dialog saying "The user just closed me". Many people have wasted thousands of hours trying to fake it in Javascript.

      --
      Live today, because you never know what tomorrow brings
    3. Re:Prototypical by GodWasAnAlien · · Score: 1

      I assume they just grew tired of the uniformed C++ masses saying. "JS is not 'real' OO, `cause it has no classes".

      Classes are not required for objects, obviously. JS always had objects with properties and methods. And while using objects as prototypes for creating other objects is different than a Class based system, objects are still objects.

      They just caved, and added class syntax sugar. You can still use JS the original/correct way, and ignore the class syntax.

      I guess the class syntax does help those C++ programmers, who in the past insisted on creating ugly class wrappers in JS. At least their c++'ized code will be slightly less ugly.

    4. Re:Prototypical by null+etc. · · Score: 2

      You can still use JS the original/correct way

      Oh, thank god there's finally a single person who can serve as the undisputed arbiter of the "correct way" to use JavaScript.

      Now if only we could force the entire world to listen to you.

    5. Re:Prototypical by nmb3000 · · Score: 1

      It's just sugar.

      True, but the end result is the same. All the same people will continue to pretend that the language is built for classes and ignore prototypes, but now even more will just use the classes interface since it's "official" now. This leaves projects or developers who do use prototypes even farther out in left field, since classes have become an even more common practice.

      I'm not going to say it's good or bad thing in a productivity or business sense, since classes are clearly more common and familiar to most people. But from just a language identity standpoint, it's a loss and that's too bad.

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
  13. Re: So that means in ten years we can use it right by jbolden · · Score: 1

    Well that's sort of the situation that accidentally exist on iOS and even on that platform there has been some demand for different engines. There are tradeoffs between engines. Say for example an engine has a bug. Do you continue to process data in line with that bug for application compatibility or fix it? Should the engine focus on newest features or on standards compliance? Should it focus on security vs. compatibility? Should it focus on minimizing time to render or minimizing power drain?

  14. The only language I've ever hated by Snotnose · · Score: 3, Funny

    I've used a lot of languages in the last 30 years, the only one I actively learned to hate was Javascript. Biggest problem being "everything is a global", followed by "Scope? We don't need no stinkin mouthwash", and finally having the behaviour be different on different machines because reasons.

    After 6 months of schedule slipping and very poor quality we finally convinced management to let us use perl. Perl ain't perfect, but it's predictable.

    1. Re:The only language I've ever hated by Anonymous Coward · · Score: 3, Insightful

      > Biggest problem being "everything is a global"

      6 months, and you did not figure out how Javascript scoping works? ... and you went back to perl ...

      ouch.

    2. Re:The only language I've ever hated by Snotnose · · Score: 3, Insightful

      Of course we figured it out. The answer was "very poorly".

    3. Re:The only language I've ever hated by phantomfive · · Score: 1

      are what is offered to denigrate a language as widely used as Javascript then

      If the best thing you can say about Javascript is that it's widely use, then you have a really lousy argument on your hands. If you use that as an argument at all, it shows you have poor understanding of the ecosystem.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:The only language I've ever hated by shutdown+-p+now · · Score: 1

      This isn't all just about globals. It is also about the hilariously stupid rules for scoping locals (where you can put "var" inside a block, but for some mysterious reason it will always be scoped in the outermost function body - contrary to both common sense and every other language with the same syntax for blocks).

      And for extra giggles, there's the mess that is the overlap of closures and foreach loops.

  15. Re: So that means in ten years we can use it righ by Anonymous Coward · · Score: 1

    Sure, let's call it "gecko". Now convince Google, Apple, Microsoft to drop their engines and use it.

  16. And Yet... by DumbSwede · · Score: 2

    While not "Officially" Codified as a Capital Crime, it is often sanctioned and applied by the state.

    Apostasy in the Islamic Republic of Iran

    From Wikipedia on Apostasy "Iran – illegal (death penalty)"

    The catch here is it is often applied under the broad umbrella "blasphemy."

    What else makes my journal entry a rant? Who is being more intellectually dishonest here?

    Do you stand corrected that the death penalty is often given in Iran for apostasy, or do you have some evidence to the contrary proving that the hundreds of links from sources like wikipedia.org, et al are Western propaganda?

    Rant implies it is not a well justified set of accusations and denouncements. As stated in the letter I have no truck with followers of Islam who allow those around them to believe and live as they want.

  17. Re: So that means in ten years we can use it right by DrXym · · Score: 1
    A single engine sounds great until a few years down the line and you realise the browser you've been using all this time is broken as fuck, filled with bugs, quirks, and other undocumented behaviour. And there is so much code relying on those things that THERE IS LITTLE YOU CAN DO ABOUT IT. Which is why some companies are still hamstrung by code which only works on IE6/7.

    It is far better to specify the standard and code against the standard. If there are problems with a particular browser they can be discretely worked around.