-
-
Notifications
You must be signed in to change notification settings - Fork 36
(Design) Exact Match Selector Options #557
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
Conversation
In response to #433 we need to choose a name for the "exact match" selector. This isn't done yet but will serve as a foundation for choosing.
I'm not sure how to best express this in the design doc, but please feel to add this as appropriate: One yardstick that I think is rather relevant here is what happens when the value we're selecting on is not a string, but e.g. a number. Put another way, substituting each of the options for
With My preference here would be for |
In the 2023-12-11 teleconference we decided to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, but see inline comments.
The exact match selector function is the function used when an implementation | ||
cannot find another selector. | ||
It is also an attribute of selectors, such as `:number` or perhaps `:date` | ||
that need to match specific values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exact match selector function is the function used when an implementation | |
cannot find another selector. | |
It is also an attribute of selectors, such as `:number` or perhaps `:date` | |
that need to match specific values. | |
The exact match selector function is the simplest selection function, | |
which compares its input to the variant keys using string equality. | |
Other selectors, such as `:number` or perhaps `:date` | |
may provide similar functionality for their supported value types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor tweaks to this suggestion.
The exact match selector function is the function used when an implementation | |
cannot find another selector. | |
It is also an attribute of selectors, such as `:number` or perhaps `:date` | |
that need to match specific values. | |
The exact match selector function is the simplest selector function, | |
which compares its operand to the variant keys using string equality. | |
Other selectors, such as `:number` and `:date` usually | |
provide similar functionality for their supported value types. |
Note that both your (@eemeli) suggestion and mine lose the "defaultness" of this selector. Do you disagree with saying that this is the selector used when no other selector's signature matches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. It looks like we accidentally dropped a line in #441 that was added in #431:
message-format-wg/spec/syntax.md
Lines 313 to 314 in 812c6dd
- Each _selector_ MUST have an _annotation_, | |
or contain a _variable_ that directly or indirectly references a _declaration_ with an _annotation_. |
In other words, we've resolved not to have a fallback or default selector. Instead, one must always be defined. I'll add a PR re-introducing that line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, your suggestion is good, and with that I'm happy to approve this.
Co-authored-by: Eemeli Aro <eemeli@mozilla.com>
The exact match selector function is the function used when an implementation | ||
cannot find another selector. | ||
It is also an attribute of selectors, such as `:number` or perhaps `:date` | ||
that need to match specific values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, your suggestion is good, and with that I'm happy to approve this.
We require annotations, so the text was inappropriate in the "background" section. Fixed it to be consistent with our policy/syntax/etc.
@eemeli I fixed the text, so check it again? You were right that we lost the normative text about annotations--and I wrote this not thinking of that. |
|
||
_Describe the proposed solution. Consider syntax, formatting, errors, registry, tooling, interchange._ | ||
|
||
The exact match selector is named `:string`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For selection, I think this is confusing. The alternative below of exact
seems much clearer. I could also live with equals
.
In the 2023-12-18 call there was a consensus to merge this as "proposed" for further consideration in the 2024-01-08 call. If you have additional proposals, please make a new PR. |
In response to #433 we need to choose a name for the "exact match" selector.
This isn't done yet but will serve as a foundation for choosing.