Vheissu / aurelia-for-real-world-web-applications-book-feedback

Post feedback as issues here on Github for the Aurelia book. Be as descriptive and honest as you like.
15 stars 0 forks source link

using ES vNext features #53

Closed opcodewriter closed 8 years ago

opcodewriter commented 8 years ago

I've seen people using ES6 code (note, not TypeScript!) like:

export class MyClass {
    myProperty;
}

This is "ES Class Fields & Static Properties", a stage 1 proposal for declarative class properties in ES: https://github.com/jeffmo/es-class-fields-and-static-properties

Since this is a stage 1, this means it has just been accepted to be examined and discussed. http://www.2ality.com/2015/11/tc39-process.html#dont-call-them-ecmascript-20xx-features

Even if babel gives us a way to use these ES6 features, is it a good idea to use them in our code? What will happen to our code if this ES6 proposal is rejected? Even if babel will continue to support it, our code will not be ES6 compliant at the time when web-browsers will finally support ES6. We should target only stage 4 features, otherwise we should go with TypeScript.

The complete list of ECMAScript proposals: https://github.com/tc39/ecma262

Not sure but I think Aurelia source code uses these stage 1 features as well and there are many Aurelia examples which use it too.

I was thinking it might be worth having a warning about this in the book. Feel free to include the above.

What do you guys think?

Vheissu commented 8 years ago

I completely agree. While it is very likely class fields and statics will eventually make it into the spec, there is always the chance they won't as history has shown. I'll add a warning into the book about it being experimental Javascript and subject to change.

PeterWone commented 8 years ago

I'd go slightly further and call out all the experimental stuff into a "to do not" list. In a sense it's like learning to do cross platform apps with Cordova - incomplete knowledge of the possible is less dangerous than incomplete knowledge of the unsupportable.