-
-
Notifications
You must be signed in to change notification settings - Fork 742
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
ICU-22747 MF2: Validate digit size for :number and :integer; validate options for :datetime #2973
base: main
Are you sure you want to change the base?
Conversation
It is not an error to write a message like that, from the point of view that this is a "valid" message. I carefully searched the formatting and registry sections and double-checked errors. It is not currently required to be an error (as an alternative, an implementation might ignore the option, although I'm dubious that this is a Good Idea). The registry part of the spec says what the value space for digit options is, but not what to do if the value provided doesn't match it. (It also fails to clearly state that what to do is implementation defined). It is permitted that implementations emit errors during function resolution (in which case, this will be an Invalid Expression error). When this is addressed (and I think it should be) I think it should be addressed in default registry, not the core spec. |
I found these errors while [commenting](unicode-org/icu#2973 (comment)) on an issue in ICU. Fixing the text for consistency.
In general the philosophy in how errors are handled in JS / Python and other other can be quite different from something like ICU. If I do throw in ICU (C++ or Java) on something like a watch, it means a firmware update that has to be explicitly pushed to millions of devices. If the spec explicitly REQUIRES such mistakes to trigger errors, then I would strongly push to change the spec. |
@aphillips @mihnita When I say "the spec requires it", I mean in the sense that the tests are part of the spec. I think I raised the question before of whether the test should be required to be an error, and Eemeli's comment here said yes, which is what I'm going off. But I'm happy to close the PR (for now) if there needs to be more discussion on the spec side. |
@catamorphism Thanks for this. @eemeli's comment and what the tests do might be the "right thing to do", but, as noted, they are not what the spec says. We need to be very careful about creating conformance tests. They need to match what the spec actually requires. I think it is valid for an implementation (ICU4C is one) to emit an error for this and render the fallback expression. But these are not syntax or data model errors. |
I found these errors while [commenting](unicode-org/icu#2973 (comment)) on an issue in ICU. Fixing the text for consistency.
I'm converting this PR to draft since it's an ongoing topic of discussion in the spec working group. |
1e0e151
to
4567804
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
In MF2, functions can be passed named option values. The spec defines two cases where built-in functions should error out when provided an unexpected value for one of its options:
For the built-in
:number
and:integer
functions: "If the value of a digit size option does not evaluate as a non-negative integer, or if the value exceeds any implementation-defined upper limit or any option-specific lower limit, a Bad Option Error is emitted." 1For the built-in
:datetime
function: "The :datetime function can use either the appropriate style options or can use a collection of field options (but not both) to control the formatted output.If both are specified, a Bad Option error MUST be emitted and a fallback value used as the resolved value of the expression." 2
This PR implements both of these checks for ICU4C.
Checklist