Live data from Hacker News

ECMAScript 2015 Approved

ecma-international.org

101–108 of 108 posts

Re: ECMAScript 2015 Approved

#101
post #35
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 even better if you use `yield` or `async/await`: activate(params) { let fabric_response = yield this.http.get(`${ this.url_base }/fabrics`) return fabric_response.content.map( fabric => { let cluster_response = yield this.http.get(`${ this.url_base }/fabrics/${ fabric.name }/clusters`) if(fabric.clusters_exist) { this.fabrics.push({"name": fabric.name, "clusters": cluster_response.content}); } }); } EDIT: note t…

I was at a meetup yesterday where Axel Rauschmayer explained what's new in ES6, and especially the use of generators and yield was to me a mindblowing new way of programming.

Yours is a nice example of using yield to turn asynchronous code synchronous.

Re: ECMAScript 2015 Approved

#102

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?

Yes, though as I understand, none of the later ones should be as big as ES6/2015. You can't accumulate that many changes in a single year.

Re: ECMAScript 2015 Approved

#103
post #61

Earlier quoted context omitted.

Compare to go, where you can go a very long way using "go get", "go build", "go run" etc.

Node.js apps can be even easier than that (only two necessary commands): `npm install` for `go get` and `node [script.js]` for `go run`. If you want to do compilation there are various solutions available to you as well!

Actually you have `npm run named-command` too so you could get a go like thing going.

Re: ECMAScript 2015 Approved

#104
post #85

Earlier quoted context omitted.

With transpilers like Babel you can fantastic browser support today.

Oddly, it would be silly to transpile to ES5 forever. By the time ES6 support is widespread, we'll be transpiling from ES8, and so on.

yes, but I expect that between feature checking and target platform configuration in the transpilers, virtually all of that will be transparent for the dev.

Re: ECMAScript 2015 Approved

#105
post #29
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.

> "a small app built on ec6/7 babel, npm, jspm, system.js, aurelia, gulp, etc" Part of the problem with the Javascript ecosystem is that you have to use so many different tools/libraries to create a "simple" app.

Eh...

Not a lot of people writing apps in Java, C, Ruby, or Python without using libraries, build tools, test runners, Makefile, frameworks, package managers, etc.

To use ES7 in production today, you need babel. And nothing is stopping you from writing a simple app in ES7, running it through babel, and shipping it. You could think of it as an updated compiler or switching to PyPy.

You probably do want a build step to lint, minify, and concatenate your code, and (if targeting the browser) to turn modules into something the browser can deal with. Which basically means webpack (or gulp+browserify), but much like a traditional Makefile (which is basically all it is), you write the webpack config once and then you're done.

And finally you probably want a framework, and probably a package manager to install it. Not a lot of people writing webapps in any language without frameworks. And downloading tarballs off sourceforge is very 1990s. So, a package manager. Does it matter if it's called gem, or npm? I don't think so.

All OP has done is listed some parts of his development environment that might just be implied with another language and framework. If someone talks about "a small app built on rails", by implication they're using a massive pile of bits. Just because you don't say "a small app built on ruby, gems, rails, rake, etc." doesn't mean they don't exist. (Hell, don't rails apps include coffeescript by default these days?)

If there's a problem, it's that "the browser as a runtime target doesn't lend itself to creating simple apps" (hence why you need all those libraries, frameworks, and elaborate build tools). But that's not really the fault of JS...and it's not like deskop apps or Android apps are any better. The last time I wrote a "simple" app (with no libraries or tooling) was in an intro to programming course in the 90s; I don't think that was a realistic example of how people wrote real applications even then.

Re: ECMAScript 2015 Approved

#106
post #103

Earlier quoted context omitted.

Node.js apps can be even easier than that (only two necessary commands): `npm install` for `go get` and `node [script.js]` for `go run`. If you want to do compilation there are various solutions available to you as well!

Actually you have `npm run named-command` too so you could get a go like thing going.

The start and test scripts are special, and can be called directly.

For an idiomatic node app, you'd clone the repo, then type `npm install` to get the dependencies, `npm test` to make sure the tests pass, and then `npm start` to run it.

Re: ECMAScript 2015 Approved

#107
post #89
post #55

Earlier quoted context omitted.

Whoa, thanks for introducing me to Babel. It looks like user plugins could be wildly, astonishingly powerful for doing compile-time code execution.

Correct. One of my favourite at the moment is `babel-plugin-rewire`, which is a neat replacement for `rewire` -- allowing easy unit testing in full isolation by hijacking the `import` statements :) [0] https://www.npmjs.com/package/babel-plugin-rewire [1] https://www.npmjs.com/package/rewire

Just started using that yesterday, and it's lovely.

Re: ECMAScript 2015 Approved

#108
post #67
post #61

Earlier quoted context omitted.

Compare to go, where you can go a very long way using "go get", "go build", "go run" etc.

They just bundled some stuff into the language's CLI. This doesn't mean it somehow doesn't exist or that the language is any simpler.

No, but it does mean that mostly everybody uses the same thing and doesn't worry about it.
Post reply on HN