-
Notifications
You must be signed in to change notification settings - Fork 14
Fallback behavior for measure units #11
Comments
The Ecma 402 committee wants to have a list in the spec of a minimum set of units that an implementation must support. This still leaves open the question though of what behavior to adopt when using a unit identifier outside of the minimum required set.
|
I'd like to put in a vote for option 4. It seems the most reliable to me. When more units are added, it would be an explicit and shared action by the group, rather than an implementation-specific thing. Since we have a standing group, it should not be hard to add units. |
Hmm. So with option 4, it requires explicit action from TC39 in order to add the additional units. Units get added somewhat frequently, a handful each year. Presumably the update could be a PR directly to the spec without a separate proposal. It still requires a human to take action, though. With all other options, no human action is required to support new units as they become available in ICU (other than updating ICU itself). |
Making that explicit change whenever there are more units to support sounds good to me. We settled on this policy for Unicode properties in RegExps, cc @mathiasbynens. |
+1 — explicit I’ve been posting an overview of what’s new in Unicode X for ECMAScript in the form of tracking issues such as tc39/ecma262#1219. PRs such as tc39/ecma262#1218 update the list of Unicode properties in RegExps. I’d love it if we can do the same thing here. |
Following the precedent set by Unicode properties SGTM. Thanks for finding that. I'll update the proposal spec text soon. |
+1 |
I am re-opening this issue just briefly. With the new "core unit identifier" syntax, users are now passing strings like "meter" instead of "length-meter". The new core unit identifiers are a little bit more user-friendly. @rxaviers pointed out previously that throwing an exception for an unknown unit is inconsistent with what we do with unknown currency codes, which is to echo out the currency code itself. The argument for the difference was that there was not a reasonable way to display the unit identifiers. However, the simplified core unit identifiers may be "good enough" that we can use those as the fallback symbols. Thoughts? |
Re-affirmed the previous consensus at today's Ecma 402 meeting. |
What should happen if you call the API with a unit identifier that the implementation doesn't know about?
A few options, each with pros and cons:
Thoughts?
The text was updated successfully, but these errors were encountered: