Skip to content
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

What is the behavior of :number when passed an option with a non-integer value? #739

Open
catamorphism opened this issue Mar 19, 2024 · 1 comment
Labels
LDML46 Items that must be first for post-tech preview (LDML46) registry

Comments

@catamorphism
Copy link
Collaborator

The spec for the :number function refers to five different options whose values must be a non-negative integer, beginning with minimumIntegerDigits and continuing from there.

However, it's unspecified what the behavior should be when something that can't be coerced to a non-negative integer is passed in for the value of one of these options. (I also assume that "non-negative integer" should include strings that can be parsed as non-negative integers; otherwise, literals as option values wouldn't work.)

If the implementation of the :number function should signal an error, that's a problem because of #738 (there is no error type that really fits this case).

If the error handling is meant to be implementation-dependent, then I think the registry spec should say that.

@catamorphism catamorphism added registry LDML46 Items that must be first for post-tech preview (LDML46) labels Mar 19, 2024
@aphillips aphillips changed the title What is the behavior of :humber when passed an option with a non-integer value? What is the behavior of :number when passed an option with a non-integer value? Mar 19, 2024
@aphillips
Copy link
Member

I also assume that "non-negative integer" should include strings that can be parsed as non-negative integers; otherwise, literals as option values wouldn't work.

The literal case should be made extremely clear in the spec because it will be the most common.

If the implementation of the :number function should signal an error, that's a problem because of #738 (there is no error type that really fits this case).

The "invalid expression" error is intended, I believe, to cover this. We didn't create a "bad option" sub-type for this error (like we did for operand mismatch), but we could.

If the error handling is meant to be implementation-dependent, then I think the registry spec should say that.

I agree that it should. I think some "bad option values" might be ignored or recoverable, while in other cases it might not be.

"implementation-dependent" might mean several things. It could allow implementations to choose what level of error to emit. Or it could define the level for that specific function/option.

aphillips added a commit that referenced this issue Mar 19, 2024
@catamorphism identified this as a gap in e.g. #739. 

This PR defines what a non-negative integer option value is for `:number` and `:integer`. It does not attempt to address the larger question raised in 738/739.
aphillips added a commit that referenced this issue Mar 26, 2024
* Define non-negative integer option

@catamorphism identified this as a gap in e.g. #739. 

This PR defines what a non-negative integer option value is for `:number` and `:integer`. It does not attempt to address the larger question raised in 738/739.

* Address @eemelie's comment

... via a rewrite.

Adds an example. Permits upper length limit. Removes any mention of types. Permits an upper numeric amount (e.g. if you're implementation of number formatting is limited to, say, 64 digits, you can make the maximum allowed value `64`)

* Update spec/registry.md

* Address comments

* Update spec/registry.md

* Update spec/registry.md

Co-authored-by: Eemeli Aro <[email protected]>

* Update spec/registry.md

Co-authored-by: Stanisław Małolepszy <[email protected]>

* Implement changes discussed in 2024-03-25 call

* Address comments

---------

Co-authored-by: Eemeli Aro <[email protected]>
Co-authored-by: Stanisław Małolepszy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LDML46 Items that must be first for post-tech preview (LDML46) registry
Projects
None yet
Development

No branches or pull requests

2 participants