2

Does dart2js support compilation to ecmascript-6 version of javascript? How do you compile to it ? If not, is it planned ?

This raises another issue for js devs. If this is done would it rely on different set of shims to work with (dart2js generated) es5 code, other than ones used already (https://github.com/paulmillr/es6-shim/).

user568109
  • 47,225
  • 17
  • 99
  • 123
  • What advantage do you expect from dart2js ES6 support? – Günter Zöchbauer Aug 07 '14 at 10:18
  • @GünterZöchbauer ES6 has its advantages. My point is if I use dart/dart2js will I miss out on ES6 ? Will I be stuck on ES5 ? Migrating ES5 to ES6 can be painfull. – user568109 Aug 07 '14 at 10:39
  • Dart2JS 'compiles' to JavaScript. JavaScript is used similar to byte code by Java/C#. The generated JavaScript is not intended to be read, modified by Human. Dart already has most advantages ES6 has and several more. Dart2js already does many of the things the shims you linked to do but it uses it for every browser no matter if they support ES6 or not (at least for now). – Günter Zöchbauer Aug 07 '14 at 10:43

1 Answers1

1

No, it doesn't.
As long as not all browsers supported by Dart (or more concrete dart2js) support EcmaScript 6 this doesn't make much sense.

I see only two reasons why dart2js might support EcmaScript 6 at some time.

  • improved speed
    when browsers can execute ES constructs faster than equivalent ES5
    shims would decrease speed for every browser that doesn't support ES6
  • build output size
    when less JS code is needed to implement the same functionality
    shims would increase the size for every browser
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • The targeted browsers will likely support it in future. Firefox and Chrome support some features already, and continue to add more. IE won't be there any sooner than rest. But again why wait for all browsers to implement ES6 fully. Given that upgrading ES5 to ES6 is no easy task. It would be a long process and dart2js will have play catchup with ES6 which I don't want. – user568109 Aug 07 '14 at 10:44