Skip to content

Commit dd2d589

Browse files
authored
[DESIGN] Effect of selectors on placeholders
Addresses #736, #747 DO NOT REVIEW YET == WORK IN PROGRESS
1 parent f6fb396 commit dd2d589

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

exploration/selection-declaration.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Effect of Selectors on Subsequent Placeholders
2+
3+
Status: **Proposed**
4+
5+
<details>
6+
<summary>Metadata</summary>
7+
<dl>
8+
<dt>Contributors</dt>
9+
<dd>@aphillips</dd>
10+
<dt>First proposed</dt>
11+
<dd>2024-03-27</dd>
12+
<dt>Pull Requests</dt>
13+
<dd>#000</dd>
14+
</dl>
15+
</details>
16+
17+
## Objective
18+
19+
_What is this proposal trying to achieve?_
20+
21+
Define what effect (if any) the _annotation_ of a _selector_ has on subsequent _placeholders_
22+
that access the same _operand_ value.
23+
24+
## Background
25+
26+
_What context is helpful to understand this proposal?_
27+
28+
In MFv2, we require that all _selectors_ have an _annotation_.
29+
30+
Ideally, a _selector_ and a _formatter_ for the same _function_ operating on the same _operand_
31+
use the same options.
32+
33+
```
34+
.input {$num :number minimumFractionDigits=2}
35+
.match {$num}
36+
one {{Unreachable in English locale}}
37+
* {{This prints {$num} with two decimal places.}}
38+
```
39+
40+
It is tempting to want to write this as a shorthand:
41+
42+
```
43+
.match {$num :number minimumFractionDigits=2}
44+
one {{Unreachable...}}
45+
* {{This prints {$num} with two decimal places.}}
46+
```
47+
48+
## Use-Cases
49+
50+
_What use-cases do we see? Ideally, quote concrete examples._
51+
52+
**Multiple Selection Conflicts**
53+
If a user writes multiple selectors for the same operand, which one formats the placeholder?
54+
55+
```
56+
.match {$num :integer} {$num :number minimumFractionDigits=2}
57+
* * {{What is printed for {$num}?}}
58+
59+
.match {$num :number minimumFractionDigits=2} {$num :integer}
60+
* * {{What is printed for {$num}?}}
61+
```
62+
63+
## Requirements
64+
65+
_What properties does the solution have to manifest to enable the use-cases above?_
66+
67+
## Constraints
68+
69+
_What prior decisions and existing conditions limit the possible design?_
70+
71+
## Proposed Design
72+
73+
_Describe the proposed solution. Consider syntax, formatting, errors, registry, tooling, interchange._
74+
75+
## Alternatives Considered
76+
77+
_What other solutions are available?_
78+
_How do they compare against the requirements?_
79+
_What other properties they have?_

0 commit comments

Comments
 (0)