Skip to content
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

Relax EBNF restriction for selectors? #82

Closed
stasm opened this issue Jan 23, 2018 · 4 comments
Closed

Relax EBNF restriction for selectors? #82

stasm opened this issue Jan 23, 2018 · 4 comments
Labels

Comments

@stasm
Copy link
Contributor

stasm commented Jan 23, 2018

According to the EBNF, message references, variant expressions nor attributes of public messages cannot be used as selectors:

fluent/spec/fluent.ebnf

Lines 70 to 74 in 589a7e9

selector-expression ::= quoted-text
| number
| external-identifier
| private-attribute-expression
| call-expression

OTOH, attributes of private messages can be used as selectors because that's how we can allow choosing the right variant for genders etc. (encoded as attributes). Attributes of private messages are language-specific which means that localizers can add any number of them to private messages.

These facts combined, it's possible to work around the EBNF like so:

-brand-name = Firefox
    .hack-message-reference = { foo }
    .hack-variant-expression = { -brand-name[genitive] }
    .hack-public-attribute = { bar.label }

hack-demo =
    { -brand-name.hack-message-reference ->
       *[Foo] I used { foo } as the selector!
    }

Should we relax the EBNF?

@stasm
Copy link
Contributor Author

stasm commented Jan 23, 2018

CC @Pike @zbraniecki @flodolo

@stasm stasm changed the title Relax restriction on selectors? Relax EBNF restriction on selectors? Jan 23, 2018
@stasm stasm changed the title Relax EBNF restriction on selectors? Relax EBNF restriction for selectors? Jan 23, 2018
@Pike
Copy link
Contributor

Pike commented Jan 23, 2018

How much overlap do we have between this and #80? Do you have a use-case in mind for this?

If this is just about being consistent, are there use-cases for non-simple attributes on private messages? Maybe the way to fix the inconsistency could also be to restrict attributes on private messages to simple string values?

@stasm
Copy link
Contributor Author

stasm commented Jan 23, 2018

How much overlap do we have between this and #80? Do you have a use-case in mind for this?

I don't see much overlap. Also, I don't have concrete use-cases; I was writing tests for projectfluent/fluent.js#130 and I realized it was possible to work around the restriction.

Restricting attributes on private messages would also solve this, thanks. I don't see use-cases for non-simple values.

@stasm stasm added this to the Syntax 0.7 milestone Jan 23, 2018
@stasm stasm added the syntax label Mar 26, 2018
@stasm stasm modified the milestones: Syntax 0.7, Syntax 0.8 Apr 4, 2018
@stasm stasm added syntax and removed syntax labels May 15, 2018
@stasm
Copy link
Contributor Author

stasm commented May 18, 2018

This is being discussed as part of #97.

@stasm stasm closed this as completed May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants