-
Notifications
You must be signed in to change notification settings - Fork 106
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
Normative: Use ListFormat for Array.prototype.toLocaleString #615
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The options
parameter conflict described in #422 is still unresolved.
Currently, |
Is this so? Note that we already call toLocaleString on each item in the list, which means we are already passing locales through any locale validation we have in 402.
Can you clarify how we would be having a behavior change? |
There is no That is: the current behavior, in the example I gave, does not validate or otherwise consume the locales parameter. With this PR, it would be validated. |
toLocaleString is invoked on nextElement, which is not necessarily a string. It could be a number or a date, e.g.: > [6543.21, " ", new Date()].toLocaleString("de")
// '6.543,21, ,25.10.2021, 18:23:51'
> navigator.userAgent
// 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36' |
Right, but in the particular example I gave, |
take the array out of it, |
Okay I see now. I'm not convinced that the new exception, which is an error case anyhow (and is a bug that it doesn't throw already), would be any less web compatible than the fact that we're changing the i18n behavior of the function. Like, I think it's more likely the case that there's software that relies on the output being |
I think it's much more likely that there is code which relies on that snippet not throwing than that there is code which relies on the particular value it produces, especially given that it has |
|
I acknowledge there are different examples than the one I gave which do throw today. However, the one I gave does not. |
Everytime we enhance the ECMA402 API it will break thing. For example, as today
will produce |
I don't expect there is any code like that in the wild today, but I would not be at all surprised to find there is code like the snippet I posted. |
I think there's a delicate balance between using our intuition to foresee webcompat issues and preventing improvements on the ground of our intuitive concerns. In this case I'm shying in the direction of not blocking this unless we can validate the web compat concern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I agree with @zbraniecki
We discussed this in the 2021-11-04 TG2 and I feel there are still other concerns which need to be addressed. But I don't think I could address them myself. I would leave this to whoever want to take it from here to work on that. |
See the issue #422 for additional discussion |
2022-05-19: This issue is too large for a PR; it should have a proposal. See #422. Volunteers would be appreciated. |
This PR address #422