-
Notifications
You must be signed in to change notification settings - Fork 2
Add a new language version for ES 6 features #26
Comments
I feel that it could be confusing to have Also, I think we shouldn't name language versions supported by Rhino after ES standard version, as there's no direct link between those two at the moment. Rhino language version are more about features rather than full compliance with the spec of particular version. So I propose to use |
My 5 cents on this. |
I agree that putting a version on ALL the features would be too much -- for However, I thought that perhaps arrow functions, in particular, should be On Wed, Jan 14, 2015 at 10:04 PM, Evgeny Shepelyuk <[email protected]
greg brail | apigee https://apigee.com/ | twitter @gbrail |
I agree that this stuff hasn't all been totally pure in the past, but I want to consider two things: First, the setting is called "languageVersion" and was used in previous versions of Rhino to enable and disable different versions of JavaScript. Second, V8 introduced a bunch of features, such as typed arrays, before others, like arrow functions. Node.js 10.x supports typed arrays, whereas a special flag is required to get some of the other stuff. Since a bunch of us are running Node.js code in Rhino, this is relevant. At the same time, 1.8 is a real version of the JavaScript language, whereas 1.9 and 2.0 are not, at least not yet. So how about this, at least for the new features that we're doing: VERSION_1_9 adds typed arrays, the new array methods, and other things that have been in V8 for a while. (We will go back to the typed arrays and "findIndex" stuff and change it to support this version only.) This version is sort of a V8-like "1.8 plus some extra features" release. VERSION_ES_6 adds arrow functions. Other things from ES6 would be added to this version as we implement them. This is easy for me to do any time, but please let me know what you think! |
Sounds reasonable, as for me - lets proceed with this approach. |
We should add a new flag:
Context.VERSION_ES_6
for features that are ECMAScript 6 only. That would include "arrow functions."
Support for arrow functions should be disabled unless the language level is set to this level.
The text was updated successfully, but these errors were encountered: