Closed balupton closed 8 years ago
Let's go all in with loose mode, as apparently it is faster due to inherent V8 optimisations... if it causes problems we'll switch to selective opt-in. Any objections?
Turns out there are many issues with going all in.
Discussion on slack arose: https://babeljs.slack.com/archives/plugins/p1453108840000636
Example issue:
Essentially:
Yeah. It is all really confusing. As essentially the differences between the modes (loose and no loose), both take the same input code, but can actually produce different output results, which may or may not go detected. Saying it just about performance, or about how the code is done, is misleading, as unfortunately, the situation seems to be - use loose mode for performant ES5 output for browsers like IE8 however ES6 features and input may fail secretly on you - or use ESNext features like for-of without loose mode, and have things fail secretly for you in ES5 environments like IE8 - either way there seems to be dragons in cross-browser use cases. https://babeljs.slack.com/archives/plugins/p1453169847000667
To just continue on from my last paragraph… It is quite a dilemma for me, as my libraries are used in all sorts of environments, modern and old, for instance, mostly node v5 environments, however Meteor users (who still run node 0.10) encounter the “missing Symbol” error of non-loose babel compilation of for-of loops on arrays - and it seems that with the current options, I either need to compile to code that will work fine for Meteor users on node 0.10 and then have secret failures with integration with ESNext code, or to compile to ESNext code and tell Meteor and older-browser users, tough luck https://babeljs.slack.com/archives/plugins/p1453170370000679
The solution could be to:
@johnthepink can I get your opinion on whether or not including the babel polyfill or the babel runtime for your meteor app is good enough a solution? /cc https://github.com/bevry/cson/pull/69
@balupton We are currently good with our fork. We don't want to stand in the way of the project moving forward. Meteor is hopefully going to upgrade node versions soon, and until then we will just use our fork.
That being said, if you get babel in there somehow, we should be able to use it. Thanks!
Will drop 0.10 support. It will be up to the user to include the babel polyfill for environments less than node 0.12.
See https://github.com/bevry/cson/issues/68 and https://phabricator.babeljs.io/T6987 as to why
One option is to use babel's loose mode. Loose mode can be opted-in selectively:
All all-in:
Would need to go through already published modules and be more intelligent on how we've done loops now.