Live data from Hacker News

ECMAScript 2015 Approved

ecma-international.org

91–100 of 108 posts

Re: ECMAScript 2015 Approved

#91

Earlier quoted context omitted.

Finding actual numbers seems to be harder than it should be, but this page: https://www.netmarketshare.com/browser-market-share.aspx?qpr... ...suggests that IE 8, 9 and 10 combined have about ~28% market share. Of course, I don't know what they're measuring --- somewhere like github is going to see a very different balance of browsers than, say, Amazon --- but that's a hell of a lot, roughly equal to the IE 11 market…

> That suggestions that netmarketshare are consistently measuring IE high That's because those tables arae StatCounter (and the W3Counter/Wikimedia things in the tables you cite) are measuring website visits. NetApplications/netmarketshare is measuring unique users. So what that data shows is likely several things going on at once: 1) Chrome (and Firefox, for that matter, if you look at te the tables)) users load mor…

Self-replying, since I have no idea what happened to the comment text I _meant_ to write and I can't edit it now. What I meant to say at the beginning of my comment was:

That's because those tables are comparing apples and oranges. StatCounter (and the W3Counter/Wikimedia things in the tables you cite) are measuring website visits. NetApplications/netmarketshare is measuring unique users.

Re: ECMAScript 2015 Approved

#92
post #86

Support for Octal numbers is insane (especially since uppercase O is supported as well as lower case o) e.g. 0O7. Add a feature that will need linting... wow. Overall happy with many of the improvements (e.g. standard syntax for modules and classes).

And still no EBCDIC! :-/

/s

Re: ECMAScript 2015 Approved

#93

Earlier quoted context omitted.

Looks like idiomatic JS code to me.

http://tritarget.org/blog/2012/11/28/the-pyramid-of-doom-a-j...

For some reason naming your functions in JavaScript often get meet with strange looks. My colleague just love anonymous functions.

I think that at least some like the callback hell, because they think it makes them look clever.

Re: ECMAScript 2015 Approved

#95

For anyone interested in using ES2015/ES6 in production, I'd highly recommend checking out jspm and SystemJS. It handles all the transpilation work for you ( at runtime for development, or during a manual build/bundling for production) using either Babel, Traceur or Typescript, and allows you to seamlessly use ES6 everywhere in your code and even load third party code on Github and NPM as ES6 modules. https://github.…

I am struggling to find the difference between jspm and npm + webpack or npm + grunt/gulp + browserify. Is it just conventions around ES6?

Re: ECMAScript 2015 Approved

#96
post #16

If you've been focusing on another language for a few years, you might not recognize JavaScript anymore. It's pretty awesome now. Here's an example of what it looks like: http://pastebin.com/raw.php?i=yEB4mrty As someone who usually works with C, Scala, and Java -- I'm currently working on a small app built on ec6/7 babel, npm, jspm, system.js, aurelia, gulp, etc. It's been a great experience so far.

Actually I do recognize those final six lines. That's what I used to get on my terminal screen decades ago when I was trying to pull the phone out of the accoustic coupler and hang up.

Re: ECMAScript 2015 Approved

#97
post #16

If you've been focusing on another language for a few years, you might not recognize JavaScript anymore. It's pretty awesome now. Here's an example of what it looks like: http://pastebin.com/raw.php?i=yEB4mrty As someone who usually works with C, Scala, and Java -- I'm currently working on a small app built on ec6/7 babel, npm, jspm, system.js, aurelia, gulp, etc. It's been a great experience so far.

It's funny to me, I used to merely tolerate JavaScript... I came from Ruby (and PHP/Java/C# before that) where you could create these super complex control flow structures and JavaScript felt so verbose and unwieldy and limited.

I mean, no inheritance? No method_missing? How do you write humane, readable DSLs with just functions and prototypes?

I've explored all kinds of tricks since then: OO libraries, promises, fibers, CoffeeScript classes and all its other sugar.

What's interesting is I've swung fully back in the other direction. I find myself increasingly drawn to very simple, very JavaScripty JavaScript. Functions. Variables. Constructors. Prototypes. Closures. Arrays. Objects. I think almost all of the new JavaScript features are more trouble than they're worth.

Take promises for example. Here's some junky callbacky JavaScript:

    libraryStuff(function() {
      moreLibraryStuff(function() {
        thirdLibraryStuff(function() {
          console.log("done!")
        })
      })
    })
Gross. Nesting. With promises you can do this lovely bit of magic:

    libraryStuff()
    .then(moreLibraryStuff)
    .then(thirdLibraryStuff)
    .then(function() {
      console.log("done!")
    })
Which certainly fixed the nesting problem. But you made your stack almost incomprehensible, and you made your execution thread harder to trace. And now the runtime is popping back and forth between your code and the promise library every step. But the scariest thing of all is you created a bunch of these promise objects that you could, like, return, and some totally unrelated code could interact with it and totally fudge up the control here. You took something that had really well bounded semantics and turned it into something that is wide open to be messed with in bizarre ways.

That's what power is. That's why people love promises, you have power to do all manner of outlandish control flow. Except I really don't want to have to debug your bizarre circus of promises.

Don't get me wrong, I am certainly capable of debugging your circus of promises. I just really would prefer not to.

And anyway there's a way easier solution. Because JavaScript uses function scope, you can just do this:

    libraryStuff(yourResponse)

    function yourResponse() {
      moreLibraryStuff(yourNextResponse)
    }

    function yourNextResponse() {
      thirdLibraryStuff(finish)
    }

    function finish() {
      console.log("done!")
    }
It's easily traceable. You get a real call stack no matter where you crash in that flow. And yeah, I doubled the number of symbols here, but that just means I was forced to actually label my application code. Which might not be such a bad idea anyway. In my production code all of these functions are going to be several lines anyway, and it's quite nice to be reminded that I should give them a good label.

Of course if this was CoffeeScript, your stacktrace wouldn't have function names because CoffeeScript threw away that feature in exchange for being able to type "->" instead of "function".

I've noticed this pattern over and over: someone gets frustrated because JavaScript doesn't give you insane tools to quickly spin up bafflingly complex flow structures. They find this frustrating, because they're used to baffling flow structures from all of the crappy code they've been forced to get comfortable with, so they write some insane library that lets you do crazy stuff in JavaScript.

The same thing happened to me in Ruby. I was so entranced by the power and magic of DSLs that I was constantly looking for excuses to return chainable objects from functions and all of this stuff. I would build things like that in production code, and feel proud of myself that I made this super powerful thing with a complicated implementation and a simple, prose-like interface.

But almost every time, after living with the interface for a while, I would realize that I could've solved the problem with just functions, literals, and arrays, and structs if I had actually taken the time to figure out the right abstractions.

Less and less do I think I need some fancy new kind of function. More and more I think I need to be more thoughtful about what the function actually does.

Re: ECMAScript 2015 Approved

#98
post #80

Earlier quoted context omitted.

Because vanilla CSS, HTML and JavaScript sucks? Hence all the tools, frameworks and scaffolds...

It would be helpful to quantify "sucks" in there. Otherwise it's simply an opinion. As an exercise, just write your own XMLHttpRequest interface. It will take you about 20 lines or less, even doing it in the most naive way. I'm serious, go do this. It will make anyone a better developer. Frameworks rarely give you much for all the baggage that comes with it. I say this as an angular user specifically, but I haven't u…

I wrote my own XMLHttp interface several times back before jquery came out thanks. No, it's not useful writing one, I know because I was there back in the IE6 days.

My point was simple, if it didn't suck, there wouldn't be all these workarounds, shims, essential libraries that every website uses, half bastardised coffee/live/closure/whatever scripts, gulps, glubs, and 1500 different templating languages.

Re: ECMAScript 2015 Approved

#99

FYI, ECMAScript 2015 is also known as ES6.

Because of their switch to use a year instead of a version number, do they plan on doing these ES enhancements more often?

It's a bit like WHAT WG's change of HTML5 to HTML (the "living standard"), but less drastic.

Re: ECMAScript 2015 Approved

#100

Earlier quoted context omitted.

Looks like idiomatic JS code to me.

http://tritarget.org/blog/2012/11/28/the-pyramid-of-doom-a-j...

'Pyramid of Doom'?

Sounds more like something from a certain python web framework to me. ie:

http://docs.pylonsproject.org/en/latest/_downloads/pyramid-a...

Post reply on HN