-
Notifications
You must be signed in to change notification settings - Fork 45
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
Rules for using expressions in text and as selectors are too complex #97
Comments
Relaxing these rules and making them linter checks would make it easier to write well-formed FTL. |
When we designed it we did plan to enable |
There still might be valid usecases for the |
I think I've come full circle on this once more (I'm getting dizzy ;-) ) I agree that removing options from accessors would make it easier to write well-formed FTL. I do think that there's a level at which "simple" syntax helpers in editing modes and tools can help to write valid FTL. Thinking about this in this context:
I think we can have more powerful tools, and also human thinking, to help people to write working fluent, by having visual patterns and syntactic rules to assist. As the attribute removal #98 proposal is more concrete, I've left two scenarios in a comment, which exemplify my thinking here. I think that the scenarios in which Term variants and attributes work as intended are complex, and I think syntax differences make those semantic differences more readily available to tooling and humans. Terminology:
|
I'd like to try relaxing our grammar to allow more expressions as well-formed selectors and placeables. In fact, I'd probably start by:
@Pike suggested that having a concrete patch to look at would make it easier to discuss this proposal. I'll prepare a PR once the grammar spec changes over to the reference parser in #101, and we'll taking from there. |
which level of breakage would then constitute a breaking change? Currently, if In the new world, if the parser allows, but the linter rejects, would it be a breaking change? |
I didn't make it clear in my previous comment: I meant relaxing the rules of using expressions in different places (placeable, selector) rather than the rules of what constitutes a valid expression. That said, thanks for bringing up the topic of compatibility. For Firefox and xchannel, it might make sense to relax the syntax of |
A comment that zibi made on the linters gave me another idea: In the kombi parser, we have two different steps to express things being OK or not: That's kinda like type-checking in a compilation step, which isn't actually at the parsing level, but still something that complains at parse time. |
Interesting! This sounds like something I'd like us to try out. |
Terms can currently have values with variants as well as attributes. Variants can be accessed with
-term[variant name]
and attributes with-term.attr
. Variants are supposed to be different facets of the same value (e.g. grammatical cases of the same noun) while attributes can provide additional grammatical information about the value, e.g. the gender, which can be used in selectors.Messages can also define variant lists and attributes. However, accessing variants on messages is not allowed. Attributes can be access with
message.attr
.To enforce this design we introduced rules for using the accessors in different contexts:
message
message.attr
message[variant]
1-term
-term.attr
-term[variant]
The rules are complex. I'd like to make this part of the syntax design simpler.
The text was updated successfully, but these errors were encountered: