Skip to content

Commit

Permalink
Cleaning up whitespace spec
Browse files Browse the repository at this point in the history
Add requirements, clarify technical choices, add examples.
  • Loading branch information
aphillips authored Oct 12, 2023
1 parent 7b3ee90 commit e89c00d
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions exploration/pattern-exterior-whitespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ _What use-cases do we see? Ideally, quote concrete examples._

_What properties does the solution have to manifest to enable the use-cases above?_

- It **_MUST_** be possible to include _message_-meaningful whitespace at the start or end of
a _pattern_.

## Constraints

_What prior decisions and existing conditions limit the possible design?_
Expand All @@ -70,13 +73,27 @@ _What prior decisions and existing conditions limit the possible design?_

_Describe the proposed solution. Consider syntax, formatting, errors, registry, tooling, interchange._

- Patterns MAY be quoted using solution 4
- User can quote whitespace using solutions 1 and 2
- All unquoted whitespace on the exterior of a pattern is not meaningful and is removed
during formatting.
- Patterns MAY be quoted (solution 4). Whitespace inside the quoting syntax is meaningful.
>```
>when foo bar {{ This pattern has exactly two spaces at the start and two at the end }} when * *
>```
- A pattern can begin or end with a quoted literal containing whitespace (or any other allowed characters).
All whitespace within a pattern is meaningful.
The quoted literal may be empty.
>```
>when foo bar {| |} This pattern has four spaces at the start and two at the end{| |} when * *
>when foo bar {||} This pattern also has four spaces at the start and two at the end {||} when * *
>```
Still being discussed:

- Whether unquoted "simple" patterns are trimmed.
This will be dealt with in the syntax spec.
>```
> Does this message have spaces at the start/end or not? {$user} wants to know.
>```
## Alternatives Considered

Expand Down

0 comments on commit e89c00d

Please sign in to comment.