-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Comments
:humber
when passed an option with a non-integer value?:number
when passed an option with a non-integer value?
The literal case should be made extremely clear in the spec because it will be the most common.
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.
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. |
@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.
* 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]>
The spec for the
:number
function refers to five different options whose values must be a non-negative integer, beginning withminimumIntegerDigits
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.
The text was updated successfully, but these errors were encountered: