Skip to content

Commit 92d8940

Browse files
authored
Update selection-declaration design doc based on mtg / issue discussion (#867)
1 parent 47c1062 commit 92d8940

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

exploration/selection-declaration.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,16 @@ _What use-cases do we see? Ideally, quote concrete examples._
139139
* {{...}}
140140
```
141141

142+
As another example of where the selection function and formatting functions differ, consider a person object provided as a formatting input.
143+
A `:gender` function can return the person's gender,
144+
but a `:personName` person name formatter function formats the name.
145+
```
146+
.match {$person :gender}
147+
male {{Bienvenido {$person :personName}}}
148+
female {{Bienvenida {$person :personName}}}
149+
other {{Le damos la bienvenida {$person :personName}}}
150+
```
151+
142152
## Requirements
143153

144154
_What properties does the solution have to manifest to enable the use-cases above?_
@@ -175,6 +185,7 @@ Examples:
175185
**Pros**
176186
- No changes required.
177187
- `.local` can be used to solve problems with variations in selection and formatting
188+
- No confusion or overlap of keywords' behavior (ex: `.match`, `.input`)
178189
- Supports multiple selectors on the same operand
179190

180191
**Cons**
@@ -217,6 +228,8 @@ declaration = s variable [s] "=" [s] expression
217228
- Produces an error when users inappropriately annotate some items
218229

219230
**Cons**
231+
- Complexity: `.match` means more than one thing
232+
- Complexity: `.match` implicitly creates a new lexical scope
220233
- Selectors can't provide additional selection-specific options
221234
if the variable name is already in scope
222235
- Doesn't allow multiple selection on the same operand, e.g.
@@ -249,6 +262,8 @@ Instead the selector's annotation replaces what came before.
249262
- Shorthand version works intuitively with minimal typing.
250263

251264
**Cons**
265+
- Complexity: `.match` means more than one thing
266+
- Complexity: `.match` implicitly creates a new lexical scope
252267
- Violates immutability that we've established everywhere else
253268

254269
### Allow _immutable_ input declarative selectors
@@ -280,6 +295,8 @@ This implies that multiple selecton on the same operand is pointless.
280295
- Produces an error when users inappropriately annotate some items
281296

282297
**Cons**
298+
- Complexity: `.match` means more than one thing
299+
- Complexity: `.match` implicitly creates a new lexical scope
283300
- Selectors can't provide additional selection-specific options
284301
if the value has already been annotated
285302
- Doesn't allow multiple selection on the same operand, e.g.
@@ -321,6 +338,7 @@ The ABNF change would look like:
321338
- Preserves immutability.
322339

323340
**Cons**
341+
- Complicates the situations where selection != formatting due to the strictness's design nudges
324342
- A separate declaration is required for each selector.
325343

326344
### Provide a `#`-like Feature

0 commit comments

Comments
 (0)