-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix for toLocaleLowercase parameter handling #1131
Conversation
Should this behavior not be behind a ECMA-402 flag? See https://tc39.es/ecma262/multipage/text-processing.html#sec-string.prototype.tolocalelowercase |
And if we're going to support the Locale param, we should support it according to the spec, which means also allowing to supply an array with multiple locales and using the best matching one (https://tc39.es/ecma402/#sup-string.prototype.tolocalelowercase) |
@p-bakker supporting an array with multiple locales is a bigger story, i only like to catch the low hanging fruits with this |
@rbri I see you changed things a bit to make it only enabled when language version >= ES6. I had suggested to put it behind a (new) ECMA_402 flag, as this feature isn't part of of the core EcmaScript standard (ECMA-262), but only part of ECMA-402, which engines can opt to implement or not. So I think we ought to have a flag to enable/disbale ECMA-402 extensions in Rhino, especially given that we're nowhere close to fully implementing ECMA-402. Maybe this is something to discuss
I understand it's a bigger story, but I wonder if we should do partial-compliant implementations. Again, maybe something to discuss |
I'm happy to merge this, but it sounds like we need to agree on whether we need a new language version for this. (IMO, we don't -- all these language version flags are very painful and not in line with what other JS engines do. Unless a new JS standard actually breaks something from an older one -- and I sure hope that they don't do that any more -- then "ES6" can be the latest, and eventually the default, option IMO. |
I think a few things are being mixed up here First we have the question of whether ECMA-402 extensions like this one (adding a Locale param to toLocaleLowerCase/toLocaleUpperCase) should be behind a feature flag or not As for language versions: I think that in the process of getting to a v2.0.0 (in which we'll disable/remove all non-ECMA-262- compliant stuff/behavior) we'll have to introduce a Context.VERSION_ECMASCRIPT, which becomes the default in v2.0.0 and from thereonwards we're done with language versions. The need for Context.VERSION_ECMASCRIPT is twofold:
So with regards to this case: my suggestion is not about putting these changes behind a new language version, but I'm questioning whether they ought to be behind a feature flag |
Some more thought on this:
|
BTW: looks like Graal also has language version flags, see https://github.com/oracle/graaljs/blob/master/docs/user/JavaScriptCompatibility.md#ecmascript-language-compliance |
Seems like @gbrail can read my mind (hopefully from the code and not from my google profile), i think we are already more or less lost in this version-switch-game. What do the others think and how to come to an decision (i have a HtmlUnit issue for this since some weeks and this is the fix and i don't like to wait soooo much longer.... |
Just to be clear: this is about putting stuff that is not part of the core JavaScript specification behind a feature flag (so not a new language version). And I'm strongly in favor of (eventually, in v2.0.0) putting all features/behaviors that are not part of the core Ecma262 specification (so also Annex B stuff) behind feature flags, so it's crystal clear what can be expected when executing Rhino. And given that the full Ecma402 implementation most likely requires additional resources (ICU data), enabling support for Ecma402 should be an explicit thing, so that also means a feature flag imho |
LGTM |
This looks good to me and I'm fine with having the feature flag. Thanks! |
No description provided.