Skip to content

Preamble: unify local variable definitions and selectors? #252

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

Closed
mihnita opened this issue May 11, 2022 · 6 comments
Closed

Preamble: unify local variable definitions and selectors? #252

mihnita opened this issue May 11, 2022 · 6 comments
Labels
blocker Blocks the release resolve-candidate This issue appears to have been answered or resolved, and may be closed soon. syntax Issues related with syntax or ABNF

Comments

@mihnita
Copy link
Collaborator

mihnita commented May 11, 2022

No description provided.

@mihnita mihnita added the syntax Issues related with syntax or ABNF label May 11, 2022
@stasm
Copy link
Collaborator

stasm commented May 12, 2022

@markusicu wrote in #230 (comment):

Also, it seems like a variable definition can have a side effect of its expression leaking into the selection syntax; don't overload unrelated functionalities.

@mihnita
Copy link
Collaborator Author

mihnita commented May 12, 2022

Comments migrated from the slides


Slides comment, Stanisław Małolepszy (@stasm), 1:42 AM Apr 26

Thanks for commenting on this. It makes me realize that we didn't explain this part of the preamble well during the presentation. All statements in the preamble are selectors, and some of them can optionally be bound to a local variable. In the example here, the preamble has a selector bound to $bar, which isn't used because the first and only variant always matches (it has no keys).


Slides comment, Mihai Nita (@mihnita), 6:50 AM Apr 26

I don't think that is the problem.
What I'm saying is that there's is no good way to differentiate between a selector and a local variable declaration until very very late.


Slides comment, Mihai Nita (@mihnita), 6:56 AM Apr 26

Wait, you mean this does both?
If yes then

  • I would expect to see 2 functions, like :plural (with an offset as an option?) and :number, with precision, rounding, etc
  • how do you declare a repeatable alias that is not a selector?

@romulocintra romulocintra added the blocker Blocks the release label May 16, 2022
@romulocintra romulocintra added this to the Technical Preview milestone May 16, 2022
@markusicu
Copy link
Member

All statements in the preamble are selectors, and some of them can optionally be bound to a local variable.

Yeah, don't. Either define a variable, or specify a selector. Combining the two is very confusing.

@stasm
Copy link
Collaborator

stasm commented Jun 1, 2022

The idea to combine selectors and local variable definitions was an attempt to simplify the syntax and the grammar with the aim of making it a good starting point. The reasoning was that something very simple ("the lower bound of complexity", as I called it before) would lend itself better to extension through discussion.

I recognize that this wasn't a good idea. It diverged from what all 3 proposals had envisioned earlier during the sessions with the CLDR TC, and introduced new problems related to larger localization workflows, like leveraging, as @mihnita explained in a meeting a few weeks ago. To summarize @mihnita's points:

  • Combining selectors and local variable definitions essentially means that everything in the preamble is a selector, some of them are bound to local variables, and only a subset of them is used for matching.
  • This inflates the total number of selectors, which impacts how many variant keys there need to be for each variant. Some of these keys shouldn't be used for matching, which means the would need to be set to the catch-all symbol (*), or elided (see Variants: can there be fewer keys for a given pattern than there are selectors in the preamble? #254).
  • These extra keys would in turn impact how leveraging systems can match variants in translations to variants in the source message. Keys are used as variants' "signatures"; adding more keys changes the signature.
  • Furthermore, a catch-all in the source language might actually map to a number of known keys in the target language. For example, a gender-neutral sentence in English can map to 2 variants in French.

So let's keep selectors separate from local variable definitions. I think this issue can be resolved (hence the resolve-candidate label) and the exact syntax decided in:

@stasm stasm added the resolve-candidate This issue appears to have been answered or resolved, and may be closed soon. label Jun 1, 2022
@romulocintra
Copy link
Collaborator

Consensus : Local variables definitions and selectors should be separated

@stasm
Copy link
Collaborator

stasm commented Jun 6, 2022

Actually, this isn't fully completed, as the EBNF on develop still doesn't differentiate between local variable definitions and selectors. But let's use #253 to design and track this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Blocks the release resolve-candidate This issue appears to have been answered or resolved, and may be closed soon. syntax Issues related with syntax or ABNF
Projects
None yet
Development

No branches or pull requests

4 participants