Skip to content

Commit

Permalink
Update selection-declaration design doc based on mtg / issue discussi…
Browse files Browse the repository at this point in the history
…on (#867)
  • Loading branch information
echeran authored Aug 26, 2024
1 parent 47c1062 commit 92d8940
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions exploration/selection-declaration.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ _What use-cases do we see? Ideally, quote concrete examples._
* {{...}}
```

As another example of where the selection function and formatting functions differ, consider a person object provided as a formatting input.
A `:gender` function can return the person's gender,
but a `:personName` person name formatter function formats the name.
```
.match {$person :gender}
male {{Bienvenido {$person :personName}}}
female {{Bienvenida {$person :personName}}}
other {{Le damos la bienvenida {$person :personName}}}
```

## Requirements

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

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

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

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

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

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

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

### Provide a `#`-like Feature
Expand Down

0 comments on commit 92d8940

Please sign in to comment.