Skip to content

Commit 527521a

Browse files
gibson042aphillipsmacchiati
authored
Clarify option literalness details (#1027)
* Clarify option literalness details Fixes #1026 * Reword description of option value literalness information Co-authored-by: Addison Phillips <[email protected]> * Update spec/formatting.md Co-authored-by: Mark Davis <[email protected]> --------- Co-authored-by: Addison Phillips <[email protected]> Co-authored-by: Mark Davis <[email protected]>
1 parent 9c9ecfc commit 527521a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

spec/formatting.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,17 @@ as well as a flag to indicate whether
137137
its formatted representation requires isolation
138138
from the surrounding text.
139139
140-
To allow for _function handlers_ to ensure that certain _option_ values are set by _literals_,
141-
the _resolved value_ of each _option_ value MUST include information about
142-
whether the _option_ value is a _literal_ or a _variable_.
140+
For each _option_ value, the _resolved value_ MUST indicate if the value
141+
was directly set with a _literal_, as opposed to being resolved from a _variable_.
142+
This is to allow _functions handlers_ to require specific _options_ to be set using _literals_.
143+
144+
> For example, the _default functions_ `:number` and `:integer` require that the _option_
145+
> `select` be set with a _literal_ (`plural`, `ordinal`, or `exact`).
146+
> Allowing a _variable_ in this _option_ would produce a _message_ that
147+
> is impossible to translate because the set of _keys_ is tied to the _selector_ chosen.
148+
149+
> [!NOTE]
150+
> Such information is irrelevant for _resolved values_ not used as the value of an _option_.
143151
144152
The form that _resolved values_ take is implementation-dependent,
145153
and different implementations MAY choose to perform different levels of resolution.
@@ -329,6 +337,7 @@ the following steps are taken:
329337
330338
6. If the call succeeds,
331339
resolve the value of the _expression_ as the result of that function call.
340+
The value MUST NOT be marked as a literal option value.
332341
333342
If the call fails or does not return a valid value,
334343
emit the appropriate _Message Function Error_ for the failure.
@@ -395,7 +404,7 @@ For each _option_:
395404
1. If supported, emit a _Bad Option_ error.
396405
1. Else:
397406
1. If the _option_ value consists of a _literal_:
398-
1. Include that information in `rv`.
407+
1. Mark `rv` as a literal option value.
399408
1. Set `res[id]` to be `rv`.
400409
1. Return `res`.
401410

0 commit comments

Comments
 (0)