From 4248630df9fe87e1fc3c2c62e3dcfec4cae347ba Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 12:40:52 -0700 Subject: [PATCH 01/22] Compare three remaining options (draft) --- exploration/syntax-exploration-2.md | 184 ++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 exploration/syntax-exploration-2.md diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md new file mode 100644 index 0000000000..e06be24c20 --- /dev/null +++ b/exploration/syntax-exploration-2.md @@ -0,0 +1,184 @@ +# Syntax Exploration v2 + +In the 2023-10-16 teleconference, we narrowed the options being considered for text-mode syntax to "1a", "2a", and "3a". +Each of these syntax candidates has been adjusted based on our conversation. + +One open issue, separately considered here, is the use of an additional sigil for some of the syntaxes. +We have generally used `#` as the placeholder for this sigil in the previous iteration. + + +## Comparison Matrix + +... goes here... + +## Candidates + +### Candidate 1a + +**Description:** Invert for Text Mode, distinguish statements from placeholders + +- Placeholders and expressions use `{`/`}`: + > `{$var}`, `{unquoted}`, `{|quoted|}`, `{$var :function}` +- Non-placeholders use `{#`/`}`: + > `{#input $user}`, `{#local $var=$foo :expr}`, `{#match {$foo}}`, `{#when * *}` + +The use of `#` as the sigil is intentional here. +This sigil might be replaced, but does not require additional escaping, as code is enclosed in `{`/`}`. +Note that the `#` sigil might also be considered to be part of the keyword, e.g. `#when`, `#local` vs. +allowing whitespace to appear between them. + +Patterns in this syntax are generally unquoted, +but MAY be quoted with the 2023-10-09 consensus `{{`/`}}` quotes. + +ASCII whitespace trimming is assumed, but is a hot topic. + +**Examples** +``` +Hello world! +``` +``` +Hello {$user} +``` +``` +{#input $user :person type=informal} +Hello {$user} + +{#input $user :person type=informal}Hello {$user} +``` +``` +{#input $var :function option=value} +{#local $foo = $bar :function option=value} +Hello {$var}, you have a {$foo} + +{#input $var :function option=value}{#local $foo = $bar :function option=value}Hello {$var}, you have a {$foo} +``` +``` +{#match {$foo} {$bar}} +{#when foo bar} Hello {$foo} you have a {$var} +{#when * *} {$foo} hello you have a {$var} + +{#match {$foo} {$bar}}{#when foo bar}Hello {$foo} you have a {$var}{#when * *}{$foo} hello you have a {$var} +``` +``` +{#match {$foo :function option=value} {$bar :function option=value}} +{#when a b} {{ {$foo} is {$bar} }} +{#when x y} {{ {$foo} is {$bar} }} +{#when * *} {| |}{$foo} is {$bar}{| |} + +{#match {$foo :function option=value} {$bar :function option=value}}{#when a b} {{ {$foo} is {$bar} }}{#when x y} {{ {$foo} is {$bar} }}{#when * *} {| |}{$foo} is {$bar}{| |} +``` + +### Candidate 2a + +**Description**: Text First, Current Syntax for "Complex" Messages + +Starts in text mode, but switches to the current "code-mode" syntax for any message containing declarations or selectors. + +- "Simple" messages (lacking declarations or selectors) are unquoted patterns. +- Patterns with declarations (`input`, `local`), selectors (`match`/`when`) or both quote all patterns. +- Pattern whitespace is always significant. + Note that "pattern whitespace" is only that whitespace that appears inside the quoting `{`/`}` + for quoted patterns. + +> The use in the previous iteration of `{{` and `}}` surrounding code-mode messages was identified as a potential negative, +> as the closing `}}` are superfluous to the message. + +The use of `>>` to represent the "starting code-mode sigil" is **_not_** final. +**_Do not fixate on the specific character sequence when choosing (or not) this design._** + +**Examples** +``` +Hello world! +``` +``` +Hello {$user} +``` +``` +>>input {$user :function option=value} +{Hello {$user}} + +>>input {$user :function option=value}{Hello {$user}} +``` +``` +>>input {$var :function option=value} +local $foo = {$bar :function option=value} +{Hello {$var}, you have a {$foo}} + +>>input {$var :function option=value}local $foo = {$bar :function option=value}{Hello {$var}, you have a {$foo}} +``` +``` +>>match {$foo} {$bar} +when foo bar {Hello {$foo} you have a {$var}} +when * * {{$foo} hello you have a {$var}} + +>>match {$foo}{$bar}when foo bar {Hello {$foo} you have a {$var}}when * * {{$foo} hello you have a {$var}} +``` + +``` +>>match {$foo :function option=value} {$bar :function option=value} +when a b { {$foo} is {$bar} } +when x y { {$foo} is {$bar} } +when * * { {$foo} is {$bar} } + +>>match {$foo :function option=value} {$bar :function option=value}when a b { {$foo} is {$bar} }when x y { {$foo} is {$bar} }when * * { {$foo} is {$bar} } +``` + +### Candidate 3a + +**Description:** Use sigils for code mode, use `{`/`}` for keys + +- Starts in text mode. +- Uses a sigil for code statements. + - Requires the code-mode sigil to be escaped in **_unquoted_** patterns. + - Quoted patterns do not require this sigil to be escaped. + - Note that decisions about auto-trimming affect the escaping situation. + If quoting the pattern is required, no additional escapes are needed. +- Placeholders and expressions use `{`/`}`: + > `{$var}`, `{unquoted}`, `{|quoted|}`, `{$var :function}` + +The use of `~` as the sigil is **_not_** an inherent part of the design here. +The actual sigil or sigil sequence needs to be decided. +Note that using a doubled-sigil reduces the need for escaping. + +Patterns in this syntax are generally unquoted, +but MAY be quoted with the 2023-10-09 consensus `{{`/`}}` quotes. + +Patterns lacking declarations, selectors, or both, are **_not_** auto-trimmed. +Whitespace in quoted patterns is significant. +Whitespace in unquoted patterns may or may not be significant (hot topic). + +``` +Hello world! +``` +``` +Hello {$user}! +``` +``` +~input {$var :function option=value} +Hello {$var} + +~input {$var :function option=value}Hello {$var} +``` +``` +~input {$var :function option=value} +~local $foo = {$bar :function option=value} +Hello {$var}, you have a {$foo} + +~input {$var :function option=value}~local $foo = {$bar :function option=value}Hello {$var}, you have a {$foo} +``` +``` +~match {$foo} {$bar} +~when{foo bar} Hello {$foo} you have a {$var} +~when{ * *} {$foo} hello you have a {$var} + +~match {$foo}{$bar}~when{foo bar} Hello {$foo} you have a {$var}~when{* *} {$foo} hello you have a {$var} +``` + +``` +~match {$foo :function option=value} {$bar :function option=value} +~when {a b} {{ {$foo} is {$bar} }} +~when {x y} {||} {$foo} is {$bar} {||} +~when {* *} {| |}{$foo} is {$bar}{| |} + +~match {$foo :function option=value}{$bar :function option=value}~when {a b}{{ {$foo} is {$bar} }}~when {x y} {||}{$foo} is {$bar} {||}~when {* *}{| |}{$foo} is {$bar}{| |} +``` From 0d44ddf74a6698f30b8e902db927d1cbaacd2ef9 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 12:59:34 -0700 Subject: [PATCH 02/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index e06be24c20..beac029374 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -65,7 +65,7 @@ Hello {$var}, you have a {$foo} {#when x y} {{ {$foo} is {$bar} }} {#when * *} {| |}{$foo} is {$bar}{| |} -{#match {$foo :function option=value} {$bar :function option=value}}{#when a b} {{ {$foo} is {$bar} }}{#when x y} {{ {$foo} is {$bar} }}{#when * *} {| |}{$foo} is {$bar}{| |} +{#match {$foo :function option=value}{$bar :function option=value}}{#when a b}{{ {$foo} is {$bar} }}{#when x y}{{ {$foo} is {$bar} }}{#when * *}{| |}{$foo} is {$bar}{| |} ``` ### Candidate 2a From cbdefb6319232c82c5987a1c033ce5eb12f8eddf Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 12:59:45 -0700 Subject: [PATCH 03/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index beac029374..8a7b44f460 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -107,11 +107,11 @@ local $foo = {$bar :function option=value} >>input {$var :function option=value}local $foo = {$bar :function option=value}{Hello {$var}, you have a {$foo}} ``` ``` ->>match {$foo} {$bar} -when foo bar {Hello {$foo} you have a {$var}} -when * * {{$foo} hello you have a {$var}} +>>match {$foo} +when foo {Hello {$foo} you have a {$var}} +when * {{$foo} hello you have a {$var}} ->>match {$foo}{$bar}when foo bar {Hello {$foo} you have a {$var}}when * * {{$foo} hello you have a {$var}} +>>match {$foo}when foo{Hello {$foo} you have a {$var}}when *{{$foo} hello you have a {$var}} ``` ``` From 2d208a28c76dea454a9cc9f2e2e6d6547f09977d Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 12:59:51 -0700 Subject: [PATCH 04/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 8a7b44f460..008c74633e 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -53,11 +53,11 @@ Hello {$var}, you have a {$foo} {#input $var :function option=value}{#local $foo = $bar :function option=value}Hello {$var}, you have a {$foo} ``` ``` -{#match {$foo} {$bar}} -{#when foo bar} Hello {$foo} you have a {$var} -{#when * *} {$foo} hello you have a {$var} +{#match {$foo}} +{#when foo} Hello {$foo} you have a {$var} +{#when *} {$foo} hello you have a {$var} -{#match {$foo} {$bar}}{#when foo bar}Hello {$foo} you have a {$var}{#when * *}{$foo} hello you have a {$var} +{#match {$foo}}{#when foo}Hello {$foo} you have a {$var}{#when *}{$foo} hello you have a {$var} ``` ``` {#match {$foo :function option=value} {$bar :function option=value}} From 534f31fff1282d0dc1ce5faa5356526cac50ec24 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:00:04 -0700 Subject: [PATCH 05/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 008c74633e..bfc55dc8f9 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -120,7 +120,7 @@ when a b { {$foo} is {$bar} } when x y { {$foo} is {$bar} } when * * { {$foo} is {$bar} } ->>match {$foo :function option=value} {$bar :function option=value}when a b { {$foo} is {$bar} }when x y { {$foo} is {$bar} }when * * { {$foo} is {$bar} } +>>match {$foo :function option=value}{$bar :function option=value}when a b{ {$foo} is {$bar} }when x y{ {$foo} is {$bar} }when * *{ {$foo} is {$bar} } ``` ### Candidate 3a From d3d65c755ce40521ae793518fa2d333cb3ea7d75 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:02:24 -0700 Subject: [PATCH 06/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index bfc55dc8f9..46a25a80b4 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -136,7 +136,7 @@ when * * { {$foo} is {$bar} } - Placeholders and expressions use `{`/`}`: > `{$var}`, `{unquoted}`, `{|quoted|}`, `{$var :function}` -The use of `~` as the sigil is **_not_** an inherent part of the design here. +The use of `%` as the sigil is **_not_** an inherent part of the design here. The actual sigil or sigil sequence needs to be decided. Note that using a doubled-sigil reduces the need for escaping. From 7c58a86c98f69db9e4477f723316324ed5d50247 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:02:29 -0700 Subject: [PATCH 07/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 46a25a80b4..c4011de03c 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -154,10 +154,10 @@ Hello world! Hello {$user}! ``` ``` -~input {$var :function option=value} +%input {$var :function option=value} Hello {$var} -~input {$var :function option=value}Hello {$var} +%input {$var :function option=value}Hello {$var} ``` ``` ~input {$var :function option=value} From 292e8df25ca6712cf0fbc58de336f6edf4abfccd Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:02:36 -0700 Subject: [PATCH 08/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index c4011de03c..c7f28eb54c 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -160,11 +160,11 @@ Hello {$var} %input {$var :function option=value}Hello {$var} ``` ``` -~input {$var :function option=value} -~local $foo = {$bar :function option=value} +%input {$var :function option=value} +%local $foo = {$bar :function option=value} Hello {$var}, you have a {$foo} -~input {$var :function option=value}~local $foo = {$bar :function option=value}Hello {$var}, you have a {$foo} +%input {$var :function option=value}%local $foo = {$bar :function option=value}Hello {$var}, you have a {$foo} ``` ``` ~match {$foo} {$bar} From 01075b43ec6baa003a779682b6da7fa0e6bead16 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:03:12 -0700 Subject: [PATCH 09/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index c7f28eb54c..cf19d7193b 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -167,11 +167,11 @@ Hello {$var}, you have a {$foo} %input {$var :function option=value}%local $foo = {$bar :function option=value}Hello {$var}, you have a {$foo} ``` ``` -~match {$foo} {$bar} -~when{foo bar} Hello {$foo} you have a {$var} -~when{ * *} {$foo} hello you have a {$var} +%match {$foo} +%when{foo} Hello {$foo} you have a {$var} +%when{*} {$foo} hello you have a {$var} -~match {$foo}{$bar}~when{foo bar} Hello {$foo} you have a {$var}~when{* *} {$foo} hello you have a {$var} +%match {$foo}%when{foo}Hello {$foo} you have a {$var}%when{*}{$foo} hello you have a {$var} ``` ``` From 41a841c8b9009cd220f380fa2861f38a344429fb Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:03:18 -0700 Subject: [PATCH 10/22] Update exploration/syntax-exploration-2.md Co-authored-by: Eemeli Aro --- exploration/syntax-exploration-2.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index cf19d7193b..56968c920b 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -175,10 +175,10 @@ Hello {$var}, you have a {$foo} ``` ``` -~match {$foo :function option=value} {$bar :function option=value} -~when {a b} {{ {$foo} is {$bar} }} -~when {x y} {||} {$foo} is {$bar} {||} -~when {* *} {| |}{$foo} is {$bar}{| |} +%match {$foo :function option=value} {$bar :function option=value} +%when {a b} {{ {$foo} is {$bar} }} +%when {x y} {||} {$foo} is {$bar} {||} +%when {* *} {| |}{$foo} is {$bar}{| |} -~match {$foo :function option=value}{$bar :function option=value}~when {a b}{{ {$foo} is {$bar} }}~when {x y} {||}{$foo} is {$bar} {||}~when {* *}{| |}{$foo} is {$bar}{| |} +%match {$foo :function option=value}{$bar :function option=value}%when {a b}{{ {$foo} is {$bar} }}%when {x y} {||}{$foo} is {$bar} {||}%when {* *}{| |}{$foo} is {$bar}{| |} ``` From 2f7517b7cfd70a6916dc387209bcd5f8aa9003dd Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 13:39:34 -0700 Subject: [PATCH 11/22] Add comparison matrix (first draft) and sigils section --- exploration/syntax-exploration-2.md | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 56968c920b..7b2615c15d 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -9,7 +9,11 @@ We have generally used `#` as the placeholder for this sigil in the previous ite ## Comparison Matrix -... goes here... +| Option | Description | Doesn’t Nest {} | Doesn’t Need More Escapes | Doesn’t Require Quoted Pattern | Counted {} works | Multiple Expression Syntaxes | +| :----- | :------------------------------------------------------------- | :-------------- | :------------------------ | :----------------------------- | :--------------- | :------------ | +| 1a | Invert for text mode, distinguish statements from placeholders | - | + | + | + | - | +| 2a | Text first, current syntax for complex messages | - | + | - | - | + | +| 3a | Use sigils for code mode, use `{`/`}` for keys | + | - | + | + | + | ## Candidates @@ -182,3 +186,27 @@ Hello {$var}, you have a {$foo} %match {$foo :function option=value}{$bar :function option=value}%when {a b}{{ {$foo} is {$bar} }}%when {x y} {||}{$foo} is {$bar} {||}%when {* *}{| |}{$foo} is {$bar}{| |} ``` + + +## Sigil Candidates + +Some of the above syntaxes require an additional sigil. + +Here are the potential sigils that can be used: + +| Sigil | Positives | Negatives | +|---|---|---| +| `!` | | Means "not" in most programming languages. | +| `@` | Feels like code? | Means "address" in a lot of contexts. Might be used for annotations | +| `#` | Feels like code. Similar to `#define`. | Common in real text. Used for _everything_ | +| `%` | Feels like code. Used by some templating languages. | Common in real text. | +| `^` | | Uncommon choice. Harder to see. | +| `&` | | Used in a lot of escapes, notably HTML. | +| `+` | | Looks like an operator. | +| `_` | Feels like code. | Looks like a name prefix. Hard to see. | +| `\|` | | Already used in our syntax for a diff purpose. Weird. | +| `>` | | Has meaning in markup. Wants to pair with `<`. | +| `<` | | Has meaning in markup. Wants to pair with `>`. | +| '?' | | Looks like `?` operator. Looks like a variable. Very common in real text. | +| '::' | | Common in real text. Looks like part of a ternary operator. | +| ';' | Can't think of any. | Looks like a statement close. | From da4ea08dd2cba440e05269a1e6018308e6caaa06 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 14:55:42 -0700 Subject: [PATCH 12/22] Fix typos --- exploration/syntax-exploration-2.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 7b2615c15d..31d0e9c8e1 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -207,6 +207,6 @@ Here are the potential sigils that can be used: | `\|` | | Already used in our syntax for a diff purpose. Weird. | | `>` | | Has meaning in markup. Wants to pair with `<`. | | `<` | | Has meaning in markup. Wants to pair with `>`. | -| '?' | | Looks like `?` operator. Looks like a variable. Very common in real text. | -| '::' | | Common in real text. Looks like part of a ternary operator. | -| ';' | Can't think of any. | Looks like a statement close. | +| `?` | | Looks like `?` operator. Looks like a variable. Very common in real text. | +| `::` | | Common in real text. Looks like part of a ternary operator. | +| `;` | Can't think of any. | Looks like a statement close. | From 57aa00825761ab7bd3ab814f3da4ce8563c1977b Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Mon, 16 Oct 2023 15:01:57 -0700 Subject: [PATCH 13/22] Flesh out sigils to make complete. --- exploration/syntax-exploration-2.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 31d0e9c8e1..1bb1d746bc 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -210,3 +210,14 @@ Here are the potential sigils that can be used: | `?` | | Looks like `?` operator. Looks like a variable. Very common in real text. | | `::` | | Common in real text. Looks like part of a ternary operator. | | `;` | Can't think of any. | Looks like a statement close. | +| `~` | | Looks like an operator. | +| `*` | | Looks like a wildcard. Already used by the syntax. | +| `-` | | Too common in normal text. | +| `=` | | Looks like an operator. Already used by the syntax. | +| `[` | | Enclosing punctuation. | +| `]` | | Enclosing punctuation. | +| `.` | | Too common in normal text. Used by other syntaxes | +| `,` | | Too common in normal text. Not code-like? | +| `\`` | | Quote mark. | +| `'` | | Quote mark. | +| `"` | | Quote mark. | From c27c0e25f945624d3b3e8b959a7fe29e38c21e33 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Tue, 17 Oct 2023 12:03:02 +0300 Subject: [PATCH 14/22] Update sigil table, adding \ --- exploration/syntax-exploration-2.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 1bb1d746bc..c9501ce6db 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -198,13 +198,14 @@ Here are the potential sigils that can be used: |---|---|---| | `!` | | Means "not" in most programming languages. | | `@` | Feels like code? | Means "address" in a lot of contexts. Might be used for annotations | -| `#` | Feels like code. Similar to `#define`. | Common in real text. Used for _everything_ | +| `#` | Feels like code. Similar to `#define`. | Common in real text. Used for _everything_, in particular comments. | | `%` | Feels like code. Used by some templating languages. | Common in real text. | | `^` | | Uncommon choice. Harder to see. | | `&` | | Used in a lot of escapes, notably HTML. | | `+` | | Looks like an operator. | | `_` | Feels like code. | Looks like a name prefix. Hard to see. | | `\|` | | Already used in our syntax for a diff purpose. Weird. | +| `\` | Feels like code. Already escaped in patterns. | May beed doubling in a resource format. | | `>` | | Has meaning in markup. Wants to pair with `<`. | | `<` | | Has meaning in markup. Wants to pair with `>`. | | `?` | | Looks like `?` operator. Looks like a variable. Very common in real text. | @@ -218,6 +219,6 @@ Here are the potential sigils that can be used: | `]` | | Enclosing punctuation. | | `.` | | Too common in normal text. Used by other syntaxes | | `,` | | Too common in normal text. Not code-like? | -| `\`` | | Quote mark. | +| ` | | Quote mark. | | `'` | | Quote mark. | | `"` | | Quote mark. | From b7a74ec462efe007270c90de940044d51aacae42 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Tue, 17 Oct 2023 07:30:24 -0700 Subject: [PATCH 15/22] Update exploration/syntax-exploration-2.md --- exploration/syntax-exploration-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index c9501ce6db..7c7df80501 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -205,7 +205,7 @@ Here are the potential sigils that can be used: | `+` | | Looks like an operator. | | `_` | Feels like code. | Looks like a name prefix. Hard to see. | | `\|` | | Already used in our syntax for a diff purpose. Weird. | -| `\` | Feels like code. Already escaped in patterns. | May beed doubling in a resource format. | +| `\` | Feels like code. Already escaped in patterns. | May require escaping (doubling) in host formats. | | `>` | | Has meaning in markup. Wants to pair with `<`. | | `<` | | Has meaning in markup. Wants to pair with `>`. | | `?` | | Looks like `?` operator. Looks like a variable. Very common in real text. | From 9c00f18852c4e48e384913cb2cd891168fc407f3 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Tue, 17 Oct 2023 07:49:49 -0700 Subject: [PATCH 16/22] Add section about sigiling and whitespace --- exploration/syntax-exploration-2.md | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 7c7df80501..366f186098 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -187,6 +187,38 @@ Hello {$var}, you have a {$foo} %match {$foo :function option=value}{$bar :function option=value}%when {a b}{{ {$foo} is {$bar} }}%when {x y} {||}{$foo} is {$bar} {||}%when {* *}{| |}{$foo} is {$bar}{| |} ``` +## Whitespace and Pattern Boundaries + +One key consideration for the above options is distinguishing the boundary between +the end of a _pattern_ and the start of a _variant_ (`when` clause). +This was not an issue in the code-mode syntax because the patterns were always delimited ("quoted"). + +> [*Note] +> This type of syntax is only needed if patterns are not quoted. +> The "hot debate" in our 2023-10-16 teleconference was between "WYSIWYG" +> no-whitespace-trimming supporters and current WG consensus. +> For current consensus and discussion of whitespace design see [here](pattern-exterior-whitespace.md) + +- Candidate 1a uses a double sigil `{#` or distinguishing sequence `{#when` to accomplish this. +- Candidate 2a quotes all patterns in code-mode. +- Candidate 3a uses a sigil-keyword sequence `%when` that required at least some additional escaping. + +It is reasonable to think that we might modify this particular part of the syntax +to improve usability. **_Keep in mind the need for single-line authoring._** + +For example: + +>``` +>%match {$foo} +>%%{0} You have no ducks. +>%%{one} You have {$foo} duck. +>%%{*} You have {$foo} ducks. +> +>%match {$foo} +>[[0]] You have no ducks. +>[[one]] You have {$foo} duck. +>[[*]] You have {$foo} duck. +>``` ## Sigil Candidates From 8ec13f3350b04d954c299a1a11331b664aa7662a Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Tue, 17 Oct 2023 13:28:06 -0700 Subject: [PATCH 17/22] Changes to 3a based on slack conversation threads --- exploration/syntax-exploration-2.md | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 366f186098..c871ddd2d5 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -13,7 +13,7 @@ We have generally used `#` as the placeholder for this sigil in the previous ite | :----- | :------------------------------------------------------------- | :-------------- | :------------------------ | :----------------------------- | :--------------- | :------------ | | 1a | Invert for text mode, distinguish statements from placeholders | - | + | + | + | - | | 2a | Text first, current syntax for complex messages | - | + | - | - | + | -| 3a | Use sigils for code mode, use `{`/`}` for keys | + | - | + | + | + | +| 3a | Use sigils for code mode | + | - | + | + | + | ## Candidates @@ -129,7 +129,7 @@ when * * { {$foo} is {$bar} } ### Candidate 3a -**Description:** Use sigils for code mode, use `{`/`}` for keys +**Description:** Use sigils for code mode - Starts in text mode. - Uses a sigil for code statements. @@ -137,12 +137,13 @@ when * * { {$foo} is {$bar} } - Quoted patterns do not require this sigil to be escaped. - Note that decisions about auto-trimming affect the escaping situation. If quoting the pattern is required, no additional escapes are needed. -- Placeholders and expressions use `{`/`}`: +- Expressions use `{`/`}`: > `{$var}`, `{unquoted}`, `{|quoted|}`, `{$var :function}` - -The use of `%` as the sigil is **_not_** an inherent part of the design here. -The actual sigil or sigil sequence needs to be decided. -Note that using a doubled-sigil reduces the need for escaping. + - There is only one expression syntax, which applies to all expressions. + - Note: placeholders are expressions. +- Variants use a double-sigil `%[` at the start and close the list of `keys` + with a `]`. + - The sequence `%[` must be escaped in unquoted patterns. Patterns in this syntax are generally unquoted, but MAY be quoted with the 2023-10-09 consensus `{{`/`}}` quotes. @@ -172,19 +173,19 @@ Hello {$var}, you have a {$foo} ``` ``` %match {$foo} -%when{foo} Hello {$foo} you have a {$var} -%when{*} {$foo} hello you have a {$var} +%[foo] Hello {$foo} you have a {$var} +%[*] {$foo} hello you have a {$var} -%match {$foo}%when{foo}Hello {$foo} you have a {$var}%when{*}{$foo} hello you have a {$var} +%match {$foo}%[foo] Hello {$foo} you have a {$var}%[*] {$foo} hello you have a {$var} ``` ``` %match {$foo :function option=value} {$bar :function option=value} -%when {a b} {{ {$foo} is {$bar} }} -%when {x y} {||} {$foo} is {$bar} {||} -%when {* *} {| |}{$foo} is {$bar}{| |} +%[a b] {{ {$foo} is {$bar} }} +%[x y] {||} {$foo} is {$bar} {||} +%[* *] {| |}{$foo} is {$bar}{| |} -%match {$foo :function option=value}{$bar :function option=value}%when {a b}{{ {$foo} is {$bar} }}%when {x y} {||}{$foo} is {$bar} {||}%when {* *}{| |}{$foo} is {$bar}{| |} +%match {$foo :function option=value} {$bar :function option=value}%[a b] {{ {$foo} is {$bar} }}%[x y] {||} {$foo} is {$bar} {||}%[* *] {| |}{$foo} is {$bar}{| |} ``` ## Whitespace and Pattern Boundaries @@ -201,7 +202,7 @@ This was not an issue in the code-mode syntax because the patterns were always d - Candidate 1a uses a double sigil `{#` or distinguishing sequence `{#when` to accomplish this. - Candidate 2a quotes all patterns in code-mode. -- Candidate 3a uses a sigil-keyword sequence `%when` that required at least some additional escaping. +- Candidate 3a uses a sigil sequence `%[` to accomplish this It is reasonable to think that we might modify this particular part of the syntax to improve usability. **_Keep in mind the need for single-line authoring._** From afeea3fa75da08ae4f21fc95e1a7fa3dda18c521 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 18 Oct 2023 08:43:48 -0700 Subject: [PATCH 18/22] Change comparison table to be more neutral about unquoted pattern --- exploration/syntax-exploration-2.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index c871ddd2d5..385ef7349c 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -9,12 +9,16 @@ We have generally used `#` as the placeholder for this sigil in the previous ite ## Comparison Matrix -| Option | Description | Doesn’t Nest {} | Doesn’t Need More Escapes | Doesn’t Require Quoted Pattern | Counted {} works | Multiple Expression Syntaxes | +> [!Note] +> The `+` and `-` values do not connote a value judgment about a given candidate. + +| Option | Description | Doesn’t Nest {} | Doesn’t Need More Escapes | Allows Unquoted Pattern | Counted {} works | Multiple Expression Syntaxes | | :----- | :------------------------------------------------------------- | :-------------- | :------------------------ | :----------------------------- | :--------------- | :------------ | | 1a | Invert for text mode, distinguish statements from placeholders | - | + | + | + | - | | 2a | Text first, current syntax for complex messages | - | + | - | - | + | | 3a | Use sigils for code mode | + | - | + | + | + | + ## Candidates ### Candidate 1a From 27565fdfcc697477100549a3665cec141fed57a0 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 18 Oct 2023 12:50:55 -0700 Subject: [PATCH 19/22] Update exploration/syntax-exploration-2.md Co-authored-by: Elango Cheran --- exploration/syntax-exploration-2.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 385ef7349c..6f58b79ffa 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -88,10 +88,7 @@ Starts in text mode, but switches to the current "code-mode" syntax for any mess Note that "pattern whitespace" is only that whitespace that appears inside the quoting `{`/`}` for quoted patterns. -> The use in the previous iteration of `{{` and `}}` surrounding code-mode messages was identified as a potential negative, -> as the closing `}}` are superfluous to the message. - -The use of `>>` to represent the "starting code-mode sigil" is **_not_** final. +The use of `{# ... #}` to represent the starting and ending code-mode sigils is **_not_** final. **_Do not fixate on the specific character sequence when choosing (or not) this design._** **Examples** From 2207a631911487a3e263fa00867677d8535fdfc2 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 18 Oct 2023 12:51:16 -0700 Subject: [PATCH 20/22] Update exploration/syntax-exploration-2.md Co-authored-by: Elango Cheran --- exploration/syntax-exploration-2.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index 6f58b79ffa..ef81e1b50e 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -99,8 +99,10 @@ Hello world! Hello {$user} ``` ``` ->>input {$user :function option=value} +{# +input {$user :function option=value} {Hello {$user}} +#} >>input {$user :function option=value}{Hello {$user}} ``` From 6315c303a276caa2073513952160312735916ebf Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 18 Oct 2023 12:51:28 -0700 Subject: [PATCH 21/22] Update exploration/syntax-exploration-2.md Co-authored-by: Elango Cheran --- exploration/syntax-exploration-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index ef81e1b50e..fb0b015a85 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -104,7 +104,7 @@ input {$user :function option=value} {Hello {$user}} #} ->>input {$user :function option=value}{Hello {$user}} +{#input {$user :function option=value}{Hello {$user}}#} ``` ``` >>input {$var :function option=value} From 74e610b307856a802eab0f551e8851633e934031 Mon Sep 17 00:00:00 2001 From: Addison Phillips Date: Wed, 18 Oct 2023 12:52:27 -0700 Subject: [PATCH 22/22] Apply suggestions from code review Co-authored-by: Elango Cheran --- exploration/syntax-exploration-2.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/exploration/syntax-exploration-2.md b/exploration/syntax-exploration-2.md index fb0b015a85..7147bf3e4b 100644 --- a/exploration/syntax-exploration-2.md +++ b/exploration/syntax-exploration-2.md @@ -107,27 +107,33 @@ input {$user :function option=value} {#input {$user :function option=value}{Hello {$user}}#} ``` ``` ->>input {$var :function option=value} +{# +input {$var :function option=value} local $foo = {$bar :function option=value} {Hello {$var}, you have a {$foo}} +#} ->>input {$var :function option=value}local $foo = {$bar :function option=value}{Hello {$var}, you have a {$foo}} +{#input {$var :function option=value}local $foo = {$bar :function option=value}{Hello {$var}, you have a {$foo}}#} ``` ``` ->>match {$foo} +{# +match {$foo} when foo {Hello {$foo} you have a {$var}} when * {{$foo} hello you have a {$var}} +#} ->>match {$foo}when foo{Hello {$foo} you have a {$var}}when *{{$foo} hello you have a {$var}} +{#match {$foo}when foo{Hello {$foo} you have a {$var}}when *{{$foo} hello you have a {$var}}#} ``` ``` ->>match {$foo :function option=value} {$bar :function option=value} +{# +match {$foo :function option=value} {$bar :function option=value} when a b { {$foo} is {$bar} } when x y { {$foo} is {$bar} } when * * { {$foo} is {$bar} } +#} ->>match {$foo :function option=value}{$bar :function option=value}when a b{ {$foo} is {$bar} }when x y{ {$foo} is {$bar} }when * *{ {$foo} is {$bar} } +{#match {$foo :function option=value}{$bar :function option=value}when a b{ {$foo} is {$bar} }when x y{ {$foo} is {$bar} }when * *{ {$foo} is {$bar} }#} ``` ### Candidate 3a