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.

80 comments

  1. Isn't that the other way around ? by Anonymous Coward · · Score: 0

    as far as standards bodies are concerned ?

  2. 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: 0

      What kind of features were worthless?

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

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

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

    4. Re:Yay! by Anonymous Coward · · Score: 0

      Those were features that were in Javascript from a long time ago.

      I'm more interested in what (mis?)features that were -added- during those 'wasted years'.

    5. Re:Yay! by Anonymous Coward · · Score: 0

      But having subtle rendering bugs because I can get away with just writing tag soup instead of something that follows an actual standard is fun!

      My favorite part about xml serialized html5 is how people tell me i'm stupid for using xml instead of just using plain ole html because then I can just throw whatever in and it usually works. Instead of you know, actually structuring your documents so they always work.

    6. Re:Yay! by Anonymous Coward · · Score: 0

      The whole problem is that nothing really useful was added to JavaScript during that time, and none of the many broken things with JavaScript were removed.

      It should never haven taken this long to get classes into JavaScript, for example. Yet this whole time we've been stuck with shitty, useless prototypes. Everyone tries to use these to build real class OO, but all we end up with are a bunch of incompatible hacks.

      What we're seeing with the current standardization is that JavaScript is slowly moving closer and closer to something that resembles C#, which is the sort of language that everybody actually wants to use in the browser.

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

      HTML is unlogical.

    8. Re:Yay! by Anonymous Coward · · Score: 0

      To be fair IEEE 754 (Or IEC 60559 to be more precise.) have plenty of flaws, just not the ones mentioned.

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

    10. Re:Yay! by Anonymous Coward · · Score: 0

      A handful of things he mentions on the "bad" and "awful" parts of JavaScript pages are due to his apparent lack of understanding of basic computer architecture.

      Not to mention C. Most of what I find tolerable about Javascript is where it is like C; most of what I hate is where it is unlike C. OK--lambda functions and closures are great, so are dynamic arrays. The stuff from Perl like === and naked regular-expression literals is painful. Javascript type-conversion rules in conjunction with the overloading of + to mean concatenation and addition is absolutely evil. What Crockford complains about in the continue statement and the set of Boolean operators are welcome friends from C.

  3. 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/

    2. Re:So that means in ten years we can use it right? by Anonymous Coward · · Score: 0

      According to https://kangax.github.io/compat-table/es6/ Babel is better than some but hardly ES6 compliant.

  4. 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 Anonymous Coward · · Score: 0

      I use Konqueror at home, and IE 9 at work. I've never installed Chrome.

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

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

      Nail that man's foot to the deck.

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

    7. Re:Great by Anonymous Coward · · Score: 0

      You can use it right now if you are a programmer that intends to make something standards compliant.

      Not everyone can work in userland.

    8. Re:Great by Anonymous Coward · · Score: 0

      But opera is dead

    9. Re:Great by Anonymous Coward · · Score: 0

      Wait. What?

      The twins of Mammon quarrelled. Their warring plunged the world into a new darkness, and the beast abhorred the darkness. So it began to move swiftly, and grew more powerful, and went forth and multiplied. And the beasts brought fire and light to the darkness.

      from The Book of Mozilla, 15:1

  5. Just what JavaScript needed by Anonymous Coward · · Score: 0

    A boatload of new syntax!

    1. Re:Just what JavaScript needed by Anonymous Coward · · Score: 0

      for(d of derogatoryReplies) {doComment("Up yours " + d.userName)}

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

    2. Re:Here is an answer (sort of) by Anonymous Coward · · Score: 0

      Why do you constantly stalk\harass apk? Your post history's loaded with lots of evidence of you doing it so don't attempt to deny it. Are you so obsessed with him doing better than you have in computing that you must stalk him harassing him constantly like a psycho you're showing us you are by doing it? He's challenged you to do better. It's evident you can't. You can't even prove his lists of points favoring hosts files wrong, agreeing with him he is correct on them from recent replies of yours in exchanges with apk you've had.

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

    2. Re:So it was approved in France? by Viol8 · · Score: 0

      It was a joke. Know what they are? Get over yourself. Oh, and I'm not an american either.

    3. Re: So it was approved in France? by Anonymous Coward · · Score: 0

      Next time you make a joke, you should make sure it's funny and not stupid.

    4. Re:So it was approved in France? by Anonymous Coward · · Score: 0

      Why do you constantly stalk and harass apk for? Your post history is littered with massive amounts of evidence of doing it so don't attempt to deny it. Are you so obsessed with him doing better than you have in computing that you must stalk him harassing him constantly, psycho? He's challenged you to do better. It's clearly evident you can't. You can't even prove his lists of points favoring hosts files wrong, agreeing with him he is correct on them from recent replies of yours in exchanges with apk you've had.

    5. Re:So it was approved in France? by Anonymous Coward · · Score: 0

      Why does APK constantly troll people who point out that he is an epic retard?

      Everyone knows it is you APK, you fucking dumbass.

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

    2. Re:What's in Javascript 6? by Anonymous Coward · · Score: 0

      Speaking as someone who writes "namespaced C" style javascript and has worked on a few sizeable js codebases - I've never found lack of classes to be a problem.

    3. Re:What's in Javascript 6? by Anonymous Coward · · Score: 0

      Probably not with all the other hopeless javascript shit going on. The lack of classes is pretty minor.

      Writing anything more than a basic scripted webpage in Javascript is a fucking joke. I love hearing JS monkeys crapping on about it... what they'll never tell you is how their pile of spaghetti code failed while running due to lack of basic fucking type checking that any sane language would have.

      At least TypeScript is a big step forward.

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

    This. How about all browsers adopt a single js/css/html engine? What should make them unique is not how they render a page, but the UI and features.

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

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

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

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

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

  13. 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 ... :-/

    1. Re:Wow, they got modules before C++ by Anonymous Coward · · Score: 0

      Yea, they can't make it "use strict" by default because it will break half the ES5 code on the web :(.

      However, code inside modules (and classes as you mentioned) is forced to "use strict", which is cool.

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

  15. 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
      /)
  16. Re: So that means in ten years we can use it righ by Anonymous Coward · · Score: 0

    I didn't say proprietary. I should be an open standard defined, open source engine.

  17. Aw, isn't that cute by Anonymous Coward · · Score: 0

    At the end of the day it's still javascript.

  18. 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?

  19. 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 Anonymous Coward · · Score: 0

      Variables in perl and JS are global by default. How hard is it to say "var" instead of "my" in order to introduce a lexical scope?

    4. Re:The only language I've ever hated by Anonymous Coward · · Score: 0

      No you didn't.

    5. Re:The only language I've ever hated by Anonymous Coward · · Score: 0

      This. Competently written Javascript software doesn't use more than one or two globals to establish a module system — everything else is scoped to properties of objects.

      When ignorant objections like "everything is a global" are what is offered to denigrate a language as widely used as Javascript then you've probably got a pretty good language on your hands. There is nothing we can to about knuckleheads that indulge petty hangups.

    6. 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."
    7. Re:The only language I've ever hated by Anonymous Coward · · Score: 0

      After 6 months of schedule slipping and very poor quality we finally convinced management to let us use perl.

      What a twist!

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

    9. Re:The only language I've ever hated by Anonymous Coward · · Score: 0

      Perl? You went from dogshit to...a steaming pile of puke mixed with dog shit and heated to boiling?

      I thought my backwards-ass company was the only group of poor bastards using Perl still.

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

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

  22. Should've thought of that before by Anonymous Coward · · Score: 0

    instead of making do with just 10 days.

  23. T.R.U.! by Anonymous Coward · · Score: 0

    Yep, there's definitely still a time and a place for xhtml.

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

    Why use something shitty like gecko when WebKit/Blink are so much better?

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

    They've all got their pros and cons. Getting everyone to agree on the "best" one is unlikely, I'd say.

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

    That engine is going to break at the first port to a system with a slightly odd graphics system.

    The problem right now is that the "standard" is a horrible mess that not only is hard to read in a structured manner, it is also hard to tell if a browser is standards compliant.
    Well, that is at least part of the problem. The other part is that HTML isn't really a good document format for displaying the things most web-pages attempt to.

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

    Wait. WebKit and Blink are the same thing? And why are they better than Gecko?

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

  29. Re:Good riddance to shitty prototype "OO"! by Anonymous Coward · · Score: 0

    Agreed. As a C++ programmer, i was really scared writing javascript.
    I really wanted classes, to define objects, as the prototypes confused me. Classes make me more conformable as that is what I am familiar with.
    Also the function scoping is confusing. I wish that was like c/c++ too.
    I just wish Javascript would also allow other cool things like operator overloading and templates.