8000 A name other than :number for plural selection · Issue #605 · unicode-org/message-format-wg · GitHub
[go: up one dir, main page]

Skip to content
A name other than :number for plural selection #605
Closed
@mihnita

Description

@mihnita

It is not new feedback, but it was ignored again and again, then :number was landed as "agreed".

Why :number is not a good name for selection?


Let's try and see how readable this is (in a fictitious programming language), without reading documentation or registry.

switch( gender($foo) ) {
...
}

Pretty clear, takes the gender if $foo and decides on it.

switch( isPrime($foo) ) {
...
}

Again, pretty clear. Probably takes a number-like thing, and returns a boolean. Without reading the registry.

switch( even($foo) ) {
...
}

Again, pretty clear. Probably takes a number-like thing, and returns a boolean. Without reading the registry.

switch( number($foo) ) {
...
}

Again, pretty clear. Takes anything, tries to get a numeric value out of it (probably by parsing it?), and returns a number.
So I expect the keys (the cases) to be numbers.
I have no reason to expect some kind of plural decision.


:number(foo) vs :string(foo) => takes foo and converts it to a number / string.

Because we have this:

switch( string($foo) ) {
...
}

which takes foo and stringifies it, then make decision on the strings.

Python has str(foo), which stringifies, and num(foo), which parses foo as a number.
Java has String.valueOf(obj), which stringifies the obj, and Integer.valueOf(str)

These are common operations, and similar ones can be found in other programming languages.
There is no programming language that has some kind of plural operation on numeric values.

So it is not at all obvious that :number(foo) means a plural decision.
If anything, it looks like parsing or casting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    LDML45LDML45 Release (Tech Preview)functionsIssue pertains to the default function set

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0