Skip to content
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

Add new selection-declaration alternative: Require annotation of selector variables in placeholders #860

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions exploration/selection-declaration.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,27 @@ is expanded to also require later uses of a variable that's used as a selector t
> each _placeholder_ _expression_ using the same _operand_ as a _selector_ MUST have an _annotation_,
> or contain a _variable_ that directly or indirectly references a _declaration_ with an _annotation_.

Example valid message:
Example invalid message with this alternative:
```
.input {$n :integer}
.match {$n :number minimumFractionDigits=2}
* {{Formats '$n' as an integer: {$n}}}
* {{Data model error: {$n}}}
```
eemeli marked this conversation as resolved.
Show resolved Hide resolved

Example invalid message:
Valid, recommended form for the above message:
```
.match {$n :integer}
* {{If $n==1.2 formats {$n} as 1.2 in en-US}}
.input {$n :number minimumFractionDigits=2}
.match {$n}
* {{Formats '$n' as a number with fraction digits: {$n}}}
```

Technically valid but not recommended:
```
.match {$n :number minimumFractionDigits=2}
* {{Formats '$n' as an integer: {$n :integer}}}
eemeli marked this conversation as resolved.
Show resolved Hide resolved

.input {$n :integer}
.match {$n :number minimumFractionDigits=2}
* {{Formats '$n' as an integer: {$n}}}
```

**Pros**
Expand Down