
ESnext – Tomorrow’s JavaScript syntax today - tosh
http://esnext.github.io/esnext/
======
Conlectus
How is this different than the already well established Traceur compiler?
[https://github.com/google/traceur-
compiler](https://github.com/google/traceur-compiler)

~~~
johnbender
IIRC, Traceur compiles to es5 which is not supported in IE 8.

[edit] It's not clear to me that this project compiles to es3, but that was my
assumption when reading "JavaScript that will work today".

~~~
v413
Looking at the compiled source, it looks like ES5 and not ES3. They use "use
strict" and Object.defineProperties which are ES5 features.

P.S. IE9 doesn't support ES5 strict mode so "use strict" might introduce some
subtle bugs for that case.

~~~
Zardoz84
I use "use strict" on JavaScript that runs over IE8/9 and I don't get errors
from it.

~~~
girvo
That's because "use strict" is ignored in IE8/9 (thankfully). You usually
won't run into any issues, but if you're relying on strict-mode for certain
semantics you can run into some very subtle bugs. The chances of that are
super low though, I've only ever done it on purpose :)

------
petercooper
Also 6to5 which was linked on HN just a few days ago:
[https://github.com/sebmck/6to5](https://github.com/sebmck/6to5)

------
girvo
Nice, and built by Square!

Now my only issue is IE8. If I could have something like this but that allowed
ES5 to run on ES4 engines, I'd be in heaven (and able to use Vue.js for work,
finally, as well as not being stuck on Angular 1.2 or whatever it is...).

One of these days I'm going to get stuck into Sweet.js and make it happen, I
swear. ES5-shim just isn't comprehensive enough, unfortunately.

~~~
SimeVidas
I don't see anything substantial missing from ES5-shim. Which APIs are you
missing?

~~~
girvo
Object.defineProperty along with a number of ES5 Object methods that don't
work at all, or don't work correctly.

Because IE8 includes it's own horrid implementation that only works on DOM
elements, the various shims for it fail (and fail in some really interesting
ways). Using Sweet.js macros and compiling it out to a differently named
method call would allow us to get around that limitation.

------
kolev
Compared to 6to5 [1], all others look subpar.

[1] [https://github.com/sebmck/6to5](https://github.com/sebmck/6to5)

------
martinrame
I don't understand something.

Why calling new Person(..,..) returns toString()?

The example calls:

console.log( 'Full name is:', new Person('Michael', 'Bluth2') );

new Person should create an instance of Person, but why it calls toString()?.

~~~
bpicolo
Because you're console.logging it

------
ktavera
While this is interesting, i'd still think that Typescript is a better choice
to use ES6 features that will work with legacy ES engines.

~~~
jeswin
Why is that? Transpiled ES6 code will stop needing the transpiler once ES6
launches. Typescript based code on the other hand will need, well, Typescript
forever. If you're willing to stray out of standardized JS territory, there
are plenty of other languages available.

~~~
WorldWideWayne
Why not Typescript? To many, it's better than Dart, not as volatile as the ES6
_draft_ and not as seemingly illogical as Coffeescript.

Plus, it comes from Microsoft and there are literally millions of devs out
there who only want to use what Microsoft is pushing because they know that if
Microsoft gets it right, they will reap the benefits of robust hiqh-quality
tools and components as history has shown them. So far it looks to a lot of us
like they're getting it right.

There's obviously no true measuring stick here. If you don't like Microsoft's
style, which I'm betting most folks here don't, then it's probably not for
you.

~~~
deathtrader666
History has shown Silverlight too..

~~~
WorldWideWayne
Exactly. Silverlight was awesome! It's the best cross platform UI kit I've
seen yet.

It's sad that the trifecta of lame known as HTML/CSS/JS won out due to the
fact that it's the only cross platform kit that native mobile environments
will fully support, since it's so non-threatening.

