6 ms·
ESnext – Tomorrow’s JavaScript syntax today
- petercooper 12y agoAlso 6to5 which was linked on HN just a few days ago: https://github.com/sebmck/6to5 https://github.com/sebmck/6to5
- kolev 12y agoCompared to 6to5 [1], all others look subpar. [1] https://github.com/sebmck/6to5 https://github.com/sebmck/6to5
- girvo 12y agoNice, 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 12y agoI don't see anything substantial missing from ES5-shim. Which APIs are you missing?
- girvo 12y agoObject.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.
- ktavera 12y agoWhile 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 12y agoWhy 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 12y agoWhy 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 12y agoHistory has shown Silverlight too..
- WorldWideWayne 12y agoExactly. 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.
- jbergens 12y agoI think that "better than Dart" is an opinion that is not shared by everyone. Personally I think Dart is better but also more different than javascript which makes it a bit harder to learn. As you said, a lot of developers on the MS stack likes to use what MS builds but others prefer things not from MS (sometimes very stubbornly :-) ).
- Conlectus 12y agoHow is this different than the already well established Traceur compiler? https://github.com/google/traceur-compiler https://github.com/google/traceur-compiler
- Touche 12y agoTraceur is more complete. ESNext requires less overhead. For most Traceur features, if you want to run it in a browser, requires a rather large runtime. ESNext is more modular. You can use just some features which may or may not require a runtime. It just depends. Overall Traceur is "better". But ESNext is nice if you just want feature X and don't want the overhead of having to support everything.
- avidal 12y agoThat's what I want to know. There are dozens of es6 transpilers.
- tekacs 12y agoYup and the place to look for comparison of them is: http://kangax.github.io/compat-table/es6/ http://kangax.github.io/compat-table/es6/ Though admittedly facts like whether they support source maps (such as Traceur) or preserve comments (not Traceur) are omitted. EJS is impressive though.
- Flenser 12y agoHad to look at the compat-table source to find out that EJS is short for Echo JS https://github.com/toshok/echo-js https://github.com/toshok/echo-js (It's definately this repo: https://github.com/kangax/compat-table/pull/115 https://github.com/kangax/compat-table/pull/115 )
- johnbender 12y agoIIRC, 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".
- martinrame 12y agoI 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()?.
- DecoPerson 12y ago"Every object has a toString() method that is automatically called when the object is to be represented as a text value or when an object is referred to in a manner in which a string is expected." https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- bpicolo 12y agoBecause you're console.logging it