-
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
Call UnwrapNumberFormat in NumberFormat.prototype.formatToParts #274
Comments
…Parts Call UnwrapNumberFormat in Intl.NumberFormat.prototype.formatToParts in order to make it more consistent to format and resolvedOptions. Fixes: tc39#274
I'm not sure if we want to add the Unwrapping here, as the unwrapping behavior was mostly a fix for the legacy mistake. I'm interested in understanding why we decided not to add the Unwrapping behavior here in the first place? cc @anba @littledan |
As @gsathya says, the unwrap logic is a legacy hack. I'd rather not add it to new things. |
It is functionally the same either way, though. I guess consistency isn't a strong enough ground to change it? |
Consistency is an important goal in general, but the design principle with this unwrapping stuff is to do as little of it as possible. See #57 for the agonizing history. |
@littledan got it! Closing this. |
@littledan I'm still confused why there is discrepancy in methods that do unwrapping. Why does |
@gsathya Because legacy code uses format and expects it to be usable this way, whereas formatToParts was added later. |
As we see in:
get Intl.NumberFormat.prototype.format
(https://tc39.github.io/ecma402/#sec-intl.numberformat.prototype.format)Intl.NumberFormat.prototype.resolvedOptions ()
(https://tc39.github.io/ecma402/#sec-intl.numberformat.prototype.resolvedoptions)Intl.NumberFormat.prototype.formatToParts
should also callUnwrapNumberFormat
as the two mentioned above instead of:/cc @gsathya
The text was updated successfully, but these errors were encountered: