l20n / spec

Specification and design documents for L20n
http://l20n.github.com/spec/
10 stars 6 forks source link

Only one member in a list of traits or a list of variants should be default #7

Closed spagy closed 7 years ago

spagy commented 8 years ago
member ::= '*'? '[' keyword ']' __ pattern NL;

Currently any and every member of a list may be marked as default. Obviously only one will actually be used as the default, so it makes sense that only marked default. I can't see any opportunity when having more than one marked would be advantageous.

stasm commented 7 years ago

You're right about the general rule. For now we decided to leave it up to consumers of the parse tree to enforce this condition. Do you have a suggestion how to encode this in the EBNF?

spagy commented 7 years ago

I'll make a PR and see what you think. I'll make it on the basis that a member list:

spagy commented 7 years ago

Actually, would it be better if a member list required one default?

stasm commented 7 years ago

I don't think so. We need member lists without defaults for traits which are HTML attributes:

foo = The textContent of Foo
    [html/title] The title of Foo
GlenDC commented 7 years ago

With the old LOL Object-List (l10n?) I used to enforce this maximum-1-default policy at the stage of turning the AST into the runtime objects. Was planning to do that this time as well, but if you have a better idea, I'm all ears :)

stasm commented 7 years ago

Closing this in favor of https://github.com/projectfluent/syntax/issues/1.