projectfluent / fluent

Fluent — planning, spec and documentation
https://projectfluent.org
Apache License 2.0
1.4k stars 45 forks source link

Make `[]` legal in selector #353

Closed AndyJado closed 2 years ago

AndyJado commented 2 years ago

I don't see progress in empty/null/undefined in selector

but is there a way I can do the following code less painful?

if-I-have-empty-string-in-selector = 
    {$hello ->
        [] {""}
        *[other] {$hello} there
    }
alerque commented 2 years ago

I don't think opening a new issue to say "no progress on old issue" is very helpful.

No answer the question, the current "correct" way to do this is with two messages and use your program logic to pick the correct message, one for when you have variables to send and a different message for when you have nothing to send.

AndyJado commented 2 years ago

well my problem is I believe that issue still has no progress for two years somehow is a issue ;)

if you have string based selector, however some specific string is implicitly illegal, may I ask why? a empty string not considered a string?

alerque commented 2 years ago

a empty string not considered a string?

Because in most programming languages an array key cannot be empty. There may be a use for it in this case, but that's exactly what the other issue proposes and there is lots of discussion about the ups and downs it will entail in various languages. If you have something to add to that discussion weigh in there, there is not point in rehashing it in a new thread and scattering the info. Scattered discussions just makes it harder to act on an issue.

AndyJado commented 2 years ago

Because in most programming languages an array key cannot be empty.

okay I see the intention now, thank you for sharing.