zbran...@mozilla.com
unread,Dec 16, 2016, 4:31:57 AM12/16/16You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mozilla-t...@lists.mozilla.org
In the thread about bi-annual syntax review, I listed a number of potential problems with the syntax.
In this proposal, I'd like to tackle mainly problem (1) and (2).
Summary:
It would be beneficial to enforce on the level of syntax that each selector should have exactly one default member.
For traits, the default trait would be required only if there is no value.
Counterarguments:
>From early feedback to this proposal, the only counter argument I can see is added overhead and added visual clutter to the syntax in scenarios where without this proposal, localizer would chose not to mark any variant/trait as default.
Response:
I believe that it's a reasonable price to pay for additional resilience, improved tooling experience and forward compatibility.
Alternative proposals:
There are two other solutions we could try:
1) We could define a named default variant, like "other".
That's what MessageFormat does. The cons against it is that it's implicit, requires "other" to be always present (while sometimes the default shouldn't be "other", but, for example, "nominative") and it doesn't work that well for traits.
2) We could use other syntax to annotate the default variant. For example:
key = { OS() ->
[[win]] Windows
[mac] Mac
[lin] Linux
}
or:
key = { OS() ->
(win) Windows
[mac] Mac
[lin] Linux
}
In my opinion the former looks more cryptic and the latter not visible.
The asterisk mark, that we chose to resemble UI paradigm of a list with a selected option, seems to be easy to understand and gets good feedback.
Thoughts?
zb.