News for hackers. Stuff that matters.
Re:The Final ES2015 (ES6) Draft by sago on Wednesday June 17, 2015 @10:42AM (#9732041)
It is so good to see ES moving again, after a decade in the wilderness. EC5 wasn't an aberration, and there are lots of productivity improvements in this and coming in ES7. A big thankyou and congratulations to the people who worked so hard on this. The work of a standardisation committees is often a thankless task.

On a slightly churlish note, the typography / graphic design of the standardisation document is absolutely horrid. From the color choices, to the (many) fonts, to the early 90s type treatment to the fake laid paper texture on the cover to inconsistent spacing inside. Shiver. Okay, superficial, but only slightly so. I genuinely think that type and book design is important for communication.

Re:The Final ES2015 (ES6) Draft by bzbarsky on Wednesday June 17, 2015 @11:27AM (#9732451)
The right answer to the typography question is probably to just use the HTML version at http://people.mozilla.org/~jorendorff/es6-draft.html for all practical purposes.
Re:The Final ES2015 (ES6) Draft by pcwalton on Wednesday June 17, 2015 @11:15AM (#9732345)
IIRC, the particular formatting in the document is required by ECMA and the ES6 committee can't do much about it.
Re:The Final ES2015 (ES6) Draft by VeejayRampay on Wednesday June 17, 2015 @06:06AM (#9730854)
If someone in the know could give me a rough estimate of "When can I expect to be using ES6 to develop applications (at least for modern browsers)?", that'd be nice.

And I'm not talking Babel or any other tools like that, I'm talking straight up ES6.

Re:The Final ES2015 (ES6) Draft by tragic on Wednesday June 17, 2015 @06:10AM (#9730860)
A good while yet, I'd expect; a lot depends on Windows 10 uptake. The browser-formerly-known-as-IE is currently running ahead of Chrome and FF on ES6 implementation, but if everyone sticks with Win7 for the next half decade it won't amount to much.

But seriously: use Babel.

Re:The Final ES2015 (ES6) Draft by VeejayRampay on Wednesday June 17, 2015 @06:12AM (#9730867)
Oh absolutely Babel is awesome, just wondering.
Re:The Final ES2015 (ES6) Draft by M2Ys4U on Wednesday June 17, 2015 @03:34PM (#9734674)
>The browser-formerly-known-as-IE is currently running ahead of Chrome and FF on ES6 implementation

Not according to Kangax's table.[0] Both Fx 39 and 40 beat out Edge, with 65%, 66% and 63% respectively.

[0] https://kangax.github.io/compat-table/es6/

Re:The Final ES2015 (ES6) Draft by lewisl9029 on Wednesday June 17, 2015 @05:58PM (#9735574)
Or better yet, use jspm with Babel and use ES6 modules for everything.

https://github.com/jspm/jspm-cli

https://github.com/systemjs/systemjs

Re:The Final ES2015 (ES6) Draft by zghst on Wednesday June 17, 2015 @06:06PM (#9735610)
What's the benefit of jspm vs webpack (which is incredibly powerful, but sloppy IMHO right now).
Re:The Final ES2015 (ES6) Draft by lewisl9029 on Wednesday June 17, 2015 @06:25PM (#9735680)
I honestly haven't used webpack much myself, but I found these two threads on the topic:

https://github.com/jspm/jspm-cli/issues/335

https://github.com/jspm/jspm-cli/issues/844

According to those, SystemJS (jspm's module loader) has the following advantages:

- Able to load any type of module as any other type of module (global, CommonJS, AMD, ES6)

- Can handle transpilation and module loading at runtime without requiring a manual build step

However, jspm itself is primarily a package manager. Its main advantages over existing package management solutions are:

- The tight integration with the SystemJS module loader for ES6 usage

- The fact that it maintains a flat dependency hierarchy with deduplication

- The ability to override package.json configuration for any dependency

- Allows loading of packages from just about any source (local git repos, Github, NPM) as any module format

Re:The Final ES2015 (ES6) Draft by cabirum on Wednesday June 17, 2015 @06:49AM (#9730965)
That's why MS gives out Win10 for free: there are zero reasons to stick with 7.
Re:The Final ES2015 (ES6) Draft by gmac on Wednesday June 17, 2015 @06:57AM (#9730999)
Here are two big reasons: (1) The IT department controls what's on your PC. (2) You have no idea how computers work.
Re:The Final ES2015 (ES6) Draft by monk_e_boy on Wednesday June 17, 2015 @07:28AM (#9731078)
Yep, there are a lot of strange peripherals attached to computers that are no longer supported. Win XP and 7 will be around for a while yet.

Out local hospital is still using IE7 - that's a lot of PCs that aren't going to get upgraded any time soon (funding cuts.)

Re:The Final ES2015 (ES6) Draft by Klathmon on Wednesday June 17, 2015 @11:09AM (#9732278)
It was my understanding that it wasn't that those things weren't "not supported" but that the drivers will no longer be included with the base install.

Stuff like off-the-wall scsi drivers, or floppy drivers, or serial port mouse support.

You can still download and install the drivers for those things, but they won't be there right away.

Re:The Final ES2015 (ES6) Draft by RussianCow on Wednesday June 17, 2015 @01:31PM (#9733698)
I don't know about Windows 10, but the driver model changed significantly with Windows Vista, so XP drivers actually will not work out of the box on newer versions of Windows. So if you're using a really old peripheral that isn't maintained anymore, chances are you won't be able to run it on a modern Windows machine.
Re:The Final ES2015 (ES6) Draft by artmageddon on Wednesday June 17, 2015 @03:06PM (#9734473)
I'm curious, assuming physical connections are still possible(i.e. ye olde COM/Serial port), how well do the use of VMs hold up in mission-critical processes such as these?
Re:The Final ES2015 (ES6) Draft by paulojreis on Wednesday June 17, 2015 @07:35AM (#9731099)
Yeah, for geeks, maybe. But, for common people, the reasoning is the opposite: there are zero reasons to switch.
Re:The Final ES2015 (ES6) Draft by cabirum on Wednesday June 17, 2015 @07:49AM (#9731149)
I think most people saw the annoying little flag in the notification area letting users to "reserve" the upgrade, so here's your reason: it won't go away until you do upgrade.
Re:The Final ES2015 (ES6) Draft by paulojreis on Wednesday June 17, 2015 @08:00AM (#9731195)
Again, that would apply to the geek user: he would upgrade just to get rid of the annoyance.

Common people typically handle annoying things in the "computer" realm: browser toolbars, pop-ups, advertising, crapware, malware. Yet, they don't upgrade because it seems "complicated", it's "technical", or something like that.

We, IT professionals as a class, have a hell of a lot to gain just by talking and watching common users.

Re:The Final ES2015 (ES6) Draft by coldtea on Wednesday June 17, 2015 @08:19AM (#9731270)
There are not that many THAT "common people" anymore with regards to technology. And even them buy a new computer ever 5 or so years or have someone who knows take care of their installations.
Re:The Final ES2015 (ES6) Draft by paulojreis on Wednesday June 17, 2015 @08:56AM (#9731451)
> There are not that many THAT "common people" anymore with regards to technology

In HN? Surely. In our little and self-centered IT shell? Mos' def'.

If you worked with and studied users, your opinion would change. Updates in particular are interesting; most people postpone them ad aeternum.

Re:The Final ES2015 (ES6) Draft by Silhouette on Wednesday June 17, 2015 @12:30PM (#9733071)
it won't go away until you do upgrade.

Sure it will. Just uninstall the Windows update KB3035583, and there it is, gone.

This is by far the most common question my less technical friends and family have been asking about their computers recently. I must have done this for 4 or 5 different people already, and entirely unscientifically it seems other technically inclined friends are getting the same request. It appears that I don't know a lot of people who actually want a new version of Windows on their existing, already working PC.

Personally, I've been recommending ignoring any Windows updates that are not explicitly security updates for quite some time now. Microsoft seem to have developed an unwelcome habit of pushing things out via that mechanism that might be in their own interests but aren't necessarily in the interests of the users.

Re:The Final ES2015 (ES6) Draft by zghst on Wednesday June 17, 2015 @06:08PM (#9735617)
IDK, bringing back the start menu sounds pretty cool. Also MSFT will basically handicap anything that is not Windows 10 as well, so there's that...
Re:The Final ES2015 (ES6) Draft by DasIch on Wednesday June 17, 2015 @10:39AM (#9732022)
In the real world organizations are still stuck on Windows XP and especially in large organizations it can take months or even years until everyone is upgraded.

Windows 10 being free matters to users at home and small businesses, it doesn't matter to anyone else.

Re:The Final ES2015 (ES6) Draft by untog on Wednesday June 17, 2015 @01:09PM (#9733483)
As a Windows Media Center user, I beg to differ.
Re:The Final ES2015 (ES6) Draft by Touche on Wednesday June 17, 2015 @10:48AM (#9732085)
> But seriously: use Babel.

Ugh, I find this to be excruciating. So you read about some new cool technology on HTML5Rocks and you want to play around with it. You have to:

* npm init

* npm install babel --save

* npm install browserify/webpack/greatest-thing-ever-of-the-week --save

* npm install gulp/grunt/broccoli/other-task-runner --save

* vi (gulp/grunt/broc/other)file.js

* Write some code to build your application.

* vi myapp.js (write some code to do your thing)

* > (gulp/grunt/broc) build

* Write an html file that includes your bundled es5.

* Open it in the browser. Yay! Cool I can debug now... wait a second I made a mistake.

* vi myapp.js and fix mistake.

* > (gulp/grunt/broc) build

* Oops I made another mistake. Better set up a watch-mode so I don't have to keep running build.

* npm install some-watch-thing --save

* vi (gulp/grunt/broc/other)file.js

* Add your watch code

* > (gulp/grunt/broc) watch

* Yay I can finally just fucking code now.

Re:The Final ES2015 (ES6) Draft by ajacksified on Wednesday June 17, 2015 @11:01AM (#9732192)
So, one more step than normal if you want to use npm dependencies in the browser, which is what you described.

If you're just playing with code, here's a simpler workflow:

* npm install babel

* write file.js

* run `babel-node file.js`

Similar to your example, the only extra step here is installing babel. If it's excruciating, install it globally and save yourself forever.

Re:The Final ES2015 (ES6) Draft by untog on Wednesday June 17, 2015 @01:10PM (#9733492)
Even better, just npm install -g babel once on any machine you use. Then it's ready for any and every .js file.
Re:The Final ES2015 (ES6) Draft by cholantesh on Wednesday June 17, 2015 @03:19PM (#9734566)
Ours is a .NET shop and we don't have plans to update to VS2015 in the near future. Does this workflow suggest that, in order to take advantage of Babel, we will have to install npm on all our dev machines and servers?
Re:The Final ES2015 (ES6) Draft by Touche on Wednesday June 17, 2015 @04:56PM (#9735247)
dev machines yes.
Re:The Final ES2015 (ES6) Draft by Touche on Wednesday June 17, 2015 @04:50PM (#9735200)
Well I have to run it every time I edit a file, maybe you missed the second half of my steps, so I still need a watch mode thingy which means probably a build script like virtually everyone using Babel is doing.

Regardless, vi index.html is much simpler.

Re:The Final ES2015 (ES6) Draft by tragic on Wednesday June 17, 2015 @11:11AM (#9732309)
While I feel your pain, and have spent a stretch or two in life-sapping Grunt Hell, this is kind of a sunk cost: ie, all this setup fiddling is necessary anyway for linting, test runs and so on - not just for the new shiny.

So, IMHO, you may as well stick the new shiny in before/after JSHint while you're in the (gulp|grunt|broc)file.

Re:The Final ES2015 (ES6) Draft by Touche on Wednesday June 17, 2015 @04:53PM (#9735223)
> While I feel your pain, and have spent a stretch or two in life-sapping Grunt Hell, this is kind of a sunk cost: ie, all this setup fiddling is necessary anyway for linting, test runs and so on - not just for the new shiny.

It's not necessary, I'm just wanting to hack at some new API I read about on the web. Assuming I need to set up a test harness, CI, and linting is putting the cart well-before the horse.

Re:The Final ES2015 (ES6) Draft by sprjr on Wednesday June 17, 2015 @01:18PM (#9733573)
* npm init * npm i -S babel * vi file.js * first line: require('babel/register'); * Yay, now you can finally just fucking code now.

Learn your tools: https://babeljs.io/docs/usage/require/

Re:The Final ES2015 (ES6) Draft by Touche on Wednesday June 17, 2015 @04:51PM (#9735211)
I have to bundle it to run it in the browser (or use babel in the client which has an entirely different set of problems). I know these tools very well.
Re:The Final ES2015 (ES6) Draft by babby on Wednesday June 17, 2015 @11:24AM (#9732421)
Try running a server which watches for file changes and then automatically recompiles without server restart, preferbly configured in the server instead of a CLI. I couldn't be nearly as productive with any other setup.
Re:The Final ES2015 (ES6) Draft by timdorr on Wednesday June 17, 2015 @12:54PM (#9733341)
Sounds like you need Lineman: http://linemanjs.com/
Re:The Final ES2015 (ES6) Draft by sehr on Wednesday June 17, 2015 @07:06PM (#9735839)
You can always just have a boilerplate ready and `gulp watch` from the start

* git clone 'boilerplate'

* npm i

* gulp watch

* Yay I can finally just fucking code now.

Re:The Final ES2015 (ES6) Draft by anarchy8 on Wednesday June 17, 2015 @12:02PM (#9732785)
Welcome to modern web development
Re:The Final ES2015 (ES6) Draft by madeofpalk on Wednesday June 17, 2015 @06:25AM (#9730901)
New Safari (in iOS 9 and next OS X) will support most of the ES 6 features. I guess it depends on what you're developing for.
Re:The Final ES2015 (ES6) Draft by robin_reala on Wednesday June 17, 2015 @08:38AM (#9731357)
Even the latest Webkit is only on 50% on Kangax’s support table. I suppose that’s better than latest Chrome (45%) but much worse than latest IE (63%) or latest Firefox (66%).
Re:The Final ES2015 (ES6) Draft by Klathmon on Wednesday June 17, 2015 @11:12AM (#9732315)
To be completely fair, most of the Chrome ES6 features are disabled via command line flag for now. When they are ready (and stable) they will all be enabled at once, and the vast majority of people will get the update within a few weeks at most.
Re:The Final ES2015 (ES6) Draft by zghst on Wednesday June 17, 2015 @06:04PM (#9735600)
IE is at 14%. Microsoft Edge is at 63% and it will be updated in 6 week sprints like Chrome supposedly.

Unlike Google or Firefox or Microsoft (who is now shamed into competing) there is no incentive for Apple to be aggressive with their ES6 implementation. Safari will remain handicapped for another year, while the other browsers slowly but surely get full support. At least we only have to wait a year (Like we did for most old CSS properties to become unprefixed).

Re:The Final ES2015 (ES6) Draft by madeofpalk on Wednesday June 17, 2015 @10:42PM (#9736556)
What incentive does Google or Firefox have for adopting ES6? How is it different to Apple?

But I agree with the sentiment - when every other browser is on multiple releases a year (Chrome at a release every 6 weeks!!!), it really is archaic when Safari is releasing only once a year.

I would love to see WebKit updates to Safari in the iOS and OS X point releases. I guess it comes down to Apple wanting to remain 'API stable' within each major OS release.

Re:The Final ES2015 (ES6) Draft by robin_reala on Thursday June 18, 2015 @03:40AM (#9737253)
Chrome went to a release every 5 weeks, Firefox stayed on a 6 week cycle.
Re:The Final ES2015 (ES6) Draft by zghst on Wednesday June 17, 2015 @05:56PM (#9735560)
I am confident full ES6 support will be really solid by March 2017. However, the community is moving incredibly fast, some companies are already using ES7 / ES2016 features!

In perspective, transpilers aren't so bad, especially Babel, who's differentiating feature from the start was readable output code.

Today, if targeting modern browsers you can use Maps and Sets. With polyfills[1] you can use the new Array functions, Promises, Symbols, full JS collections, iterators, etc.

[1] https://github.com/zloirock/core-js

Re:The Final ES2015 (ES6) Draft by atirip on Wednesday June 17, 2015 @06:18AM (#9730886)
Why? What is the thing you can do in ES6 that you can't in ES5? Features that affect execution speed or real memory consumption positively. Leave hipster features out.
Re:The Final ES2015 (ES6) Draft by tragic on Wednesday June 17, 2015 @06:29AM (#9730915)
That's an extraordinarily reductive view of improvements to a programming language. A basic example: cleaner syntax for anonymous functions will have (presumably) almost no effect on speed/memory either which way, but will make code more readable. Which is not a 'hipster' concern.
Re:The Final ES2015 (ES6) Draft by TazeTSchnitzel on Wednesday June 17, 2015 @07:36AM (#9731102)
It's the difference between

  var map = function (f) {
    return function (list) {
      return list.map(f);
    };
  };
and

  const map = f => list => list.map(f);
Re:The Final ES2015 (ES6) Draft by coev on Wednesday June 17, 2015 @07:35AM (#9731098)
Also: "this" is bound for you in fat arrow functions without having to resort to function.prototype.bind or "var that = this;" trickery. That's an issue I've seen bite many people before and it'll be nice to have an easy way to avoid that.
Re:The Final ES2015 (ES6) Draft by VeejayRampay on Wednesday June 17, 2015 @06:44AM (#9730953)
Upvoted your comment so that everyone can see it.

ES6 has template strings, destructuring assignment, Map and Set data structures (and more). While you're right and it is not NEEDED, this is something that dramatically improves on the weakest aspects of ECMASscript.

Based on your comment, it feels like no addition is ever a good addition if you can express it with the building bricks you already have. With such a way of seeing things, we'd all be coding with assembly language, cause nothing really affects speed or memory consumption for the better.

Re:The Final ES2015 (ES6) Draft by atirip on Wednesday June 17, 2015 @06:57AM (#9730994)
No-no, there has been lot of features added to Javascript (i started writing it around 2003) that were not shimmable in earlier versions.
Re:The Final ES2015 (ES6) Draft by karoladamiec on Wednesday June 17, 2015 @09:40AM (#9731655)
One reason to rule them all: Generator functions.

Why it is a big deal one might ask. It is the BIGGEST deal in history of Javascript in my book because it allows you to do async that looks sync. No more callback hell. It is the single most important feature, as it eliminates async issues completely. And EVERYTHING in js is async. But in reality, you want to drop into async only sometimes. Now you are forced into it 100% time, even when you need the result of async call to decide what to do next. It gets tricky really fast.

Re:The Final ES2015 (ES6) Draft by CoryG89 on Wednesday June 17, 2015 @10:32AM (#9731976)
I guess to each their own then. I really just want the new syntax features, modules, classes, const,maybe template strings will be nice too. I work with async ES5 code all the time and I don't have many problems with async when using promises. I know promises are also coming with ES6, but almost everyone uses them today in ES5.
Re:The Final ES2015 (ES6) Draft by karoladamiec on Wednesday June 17, 2015 @10:58AM (#9732172)
Well promises help. And then they stop :). Stop helping. They just break under the weight. If you have promise chain that gets too long, you will feel the pain.

The whole thing is, when some IO returns 1 or 2. And your next step is to do a or b depending on the reply. How is your neat promise chain looking now? Then repeat 100 times :(

Not even mentioning error handling... and stack traces.

So i do agree that it depends what you do a lot. Maybe there are domains where it is not important... but i still need to see that one.

And i will take blocking IO with try/catch 10 times out of 10. Even when it is not critical. It is just nicer and easier to reason about.

Re:The Final ES2015 (ES6) Draft by babby on Wednesday June 17, 2015 @11:30AM (#9732478)
require('bluebird').coroutine function*() {}

Promises + Generators = The sweet spot.

Check out https://www.npmjs.com/package/coroutiner to make it stupid-easy to coroutine your entire app.

Re:The Final ES2015 (ES6) Draft by karoladamiec on Wednesday June 17, 2015 @11:56AM (#9732728)
That is one perfectly fine way to do it. But that is exactly what i want to highlight. The generators. You can combine them with promises, callbacks, even the CSP channels. But you need the generator. That is where magic happens and no amount of library code will do that for you, one needs compiler support (or a macro...)
Re:The Final ES2015 (ES6) Draft by SerpentJoe on Wednesday June 17, 2015 @11:36AM (#9732549)
Promises are certainly better than promise-free 2005 style callback code, but they do require that you reimplement language features like try/catch. Yield allows you to do asynchronous try/catch, which doesn't depend on some library getting the implementation right (libraries often lump rejections and thrown exceptions together) and looks more sensible anyway.

There are other advantages to yield as well. Entire design patterns like CSP aren't possible without it.

Re:The Final ES2015 (ES6) Draft by realistschuckle on Wednesday June 17, 2015 @07:29AM (#9731083)
Proxies. You can't shim in the Proxy object. Ain't no hipster feature there.
Re:The Final ES2015 (ES6) Draft by spion on Wednesday June 17, 2015 @10:20AM (#9731894)
You can't even transpile it without massively different output from the transpiler, which is a bit bad.
Re:The Final ES2015 (ES6) Draft by etimberg on Wednesday June 17, 2015 @06:55AM (#9730988)
Map and set are much nicer in ES6 as built in objects.
Re:The Final ES2015 (ES6) Draft by btd on Wednesday June 17, 2015 @07:54AM (#9731164)
imo map and set useless. Real advantage of maps only that you can use any type of keys, but really why not convenrt them to string represntation and put to simple object? Map .has method uses === for object search. For set the same, just use object with keys and dummy values.
Re:The Final ES2015 (ES6) Draft by bzbarsky on Wednesday June 17, 2015 @11:30AM (#9732486)
> but really why not convenrt them to string represntation and put to simple object?

Because as soon as you might have "toString" or "__proto__" as a key things go all haywire.

Re:The Final ES2015 (ES6) Draft by woah on Wednesday June 17, 2015 @10:13AM (#9731856)
Why do all these strange workarounds?
Re:The Final ES2015 (ES6) Draft by sirsuki on Wednesday June 17, 2015 @08:06AM (#9731215)
The Final ES1015 (ES6) Draft

Am I the only one noticing the oxymoron there?

Re:The Final ES2015 (ES6) Draft by coldtea on Wednesday June 17, 2015 @08:17AM (#9731256)
No. "Final Draft" is a very standard term in books/scripts/standards/legal docuemnts/etc (actually there's even a scriptwriting app bearing that name).

It's the final draft as in "the last in the series of draft revisions", meaning than after that the actual standard document is going to be voted / published -- at worse with very minor last minute corrections.

Re:The Final ES2015 (ES6) Draft by bsimpson on Wednesday June 17, 2015 @02:22PM (#9734127)
And not long after this went up, the ECMA approved ES2015.
Re:The Final ES2015 (ES6) Draft by coldtea on Wednesday June 17, 2015 @02:49PM (#9734381)
And there was much rejoicing...
Re:The Final ES2015 (ES6) Draft by netcraft on Wednesday June 17, 2015 @08:17AM (#9731255)
I believe thats exactly what it is - the latest revision of the document that will go on to be voted on and accepted.

>This draft has been submitted to the Ecma General Assembly members for their review and consideration. The GA will vote on approving it as a Ecma standard at their June 2015 meeting.

>Assuming GA approval, it will still be possible to make very minor editorial corrections in the published version.

Re:The Final ES2015 (ES6) Draft by bshimmin on Wednesday June 17, 2015 @10:52AM (#9732121)
I get documents from designers with names like "FINAL homepage v23 latest updated FINAL_2 (3).psd" all the time...
Re:The Final ES2015 (ES6) Draft by M8 on Wednesday June 17, 2015 @12:25PM (#9733019)
Expect the Final Final pre-Release post-Draft. ES6 will never get released.
Re:The Final ES2015 (ES6) Draft by M2Ys4U on Wednesday June 17, 2015 @03:39PM (#9734710)