top | item 11705807

(no title)

thejaredhooper | 9 years ago

Can someone explain to me the use of a transpiler like this? I'm a novice and I can't think of any personal use cases

discuss

order

nothrabannosir|9 years ago

you mean transpilers like this, and Babel, in general?

You want to write ES6 code today, but your clients (= browsers) don't support it yet. So you use the transpiler: write ES6, compile to ES5, serve that.

It's the opposite of what Python did with the 2to3 tool, where you wrote Python 2, and converted it to Python 3 before running.

Why do you want to write ES6? Well, hopefully, every change ES6 introduces to ES5 is an improvement. I'd hope. So every different thing between them, you'd want to use, sort of by definition. That's the idea, at least :)

tracker1|9 years ago

For me, the biggest changes are the syntax sugar... rest, spread, fat-arrow syntax, destructured assignment, etc. The vnext bits I'm most using are async/await, and some of the class/property extensions, and more rest/spread/destructuring extensions. A lot of the other stuff is of less interest to me in writing code, but I can see how they would appeal to others.

Not every piece has to be useful to everyone.

draw_down|9 years ago

Executing ES6 code today on an ES5 runtime.