Type | Wish | Status | submitted | Date | 27-Feb-2015 15:47 |
---|---|---|---|---|---|
Version | r3 master | Category | Unspecified | Submitted by | fork |
Platform | All | Severity | major | Priority | normal |
Summary | Escaping in ANY-WORD! types with caret |
---|---|
Description |
(Note: This is categorized "major" because it is an alteration to how any previously existing words using carets would be handled.) One complaint I've repeatedly voiced is that there shouldn't be restrictions on what legal characters can be in an ANY-WORD! if built using a construction syntax. Being an ANY-WORD! datatype in dialect design may be a signal that the type of the word signifies something...for instance a dialect translating an old assembly language might want to translate `label "foo"` into something like `foo:`. This might work on nearly all cases in practice, but if the source medium didn't explicitly prohibit something like `label ":foo"`, even the rarest incident of this will break a dialect trying to achieve a 1-to-1 mapping. Concordantly, saying that a "word cannot contain spaces" is something akin to saying that a "string cannot contain quotes". It denies the importance of escaping when working with these types as dialect-building tinker-toys. So I propose the idea that escaping in ANY-WORD! works like escaping in strings. Let's assume ^(20) can be escaped as ^(space), or as ^_ (suggestion from @pekr, recorded in #2196): >> print quote some^_word^_with^_spaces some word with spaces Note that mold would be escape-aware: >> mold quote some^_word^_with^_spaces "some^^_word^^_with^^_spaces" >> print mold quote some^_word^_with^_spaces some^_word^_with^_spaces I'd propose that ^(space), ^(newline), and ^(carriage-return) be alternate forms for those interested in being more clear/verbose in the escaping, lining up with the words for characters as they come in the box. ^(tab) already exists. Be sure to have a look at #2203, for one of the many interesting possibilities this escape syntax would enable. |
Example code |
Assigned to | n/a | Fixed in | - | Last Update | 13-Mar-2015 10:22 |
---|
Comments | |
---|---|
(0004604)
abolka 13-Mar-2015 07:53 |
(I slightly edited the original description to split the two suggestions previously combined in this ticket into two: this one and #2203.) |
(0004607)
MarkI 13-Mar-2015 10:22 |
Some string escapes would interfere with visually scanning code if they were allowed in words.
^/, ^[, and ^], to list some of them. As delimiters are quite overloaded already, I would recommend staying away from them if possible. There are plenty of escapes that can be built using the existing non-alphanumeric word characters !&*=?_|~ only. Or you could even dip into the special characters like +.- that are "mostly" word-like. For example, ^| is a perfect choice for newline, if you really, really, hate ^j. |
Date | User | Field | Action | Change |
---|---|---|---|---|
15-Mar-2015 07:21 | MarkI | Comment : 0004607 | Modified | - |
15-Mar-2015 07:20 | MarkI | Comment : 0004607 | Modified | - |
15-Mar-2015 07:18 | MarkI | Comment : 0004607 | Modified | - |
15-Mar-2015 07:17 | MarkI | Comment : 0004607 | Modified | - |
15-Mar-2015 07:17 | MarkI | Comment : 0004607 | Modified | - |
13-Mar-2015 10:40 | MarkI | Comment : 0004607 | Modified | - |
13-Mar-2015 10:22 | MarkI | Comment : 0004607 | Added | - |
13-Mar-2015 07:53 | abolka | Comment : 0004604 | Added | - |
13-Mar-2015 07:51 | abolka | Description | Modified | - |
13-Mar-2015 07:51 | abolka | Summary | Modified | Escaping in ANY-WORD! types with caret, replace CR/LF/SP => Escaping in ANY-WORD! types with caret |
27-Feb-2015 21:47 | Fork | Description | Modified | - |
27-Feb-2015 21:46 | Fork | Description | Modified | - |
27-Feb-2015 21:41 | Fork | Description | Modified | - |
27-Feb-2015 19:42 | Fork | Description | Modified | - |
27-Feb-2015 18:13 | Fork | Description | Modified | - |
27-Feb-2015 17:53 | Fork | Description | Modified | - |
27-Feb-2015 17:52 | Fork | Description | Modified | - |
27-Feb-2015 17:32 | Fork | Description | Modified | - |
27-Feb-2015 17:32 | Fork | Summary | Modified | Escaping in ANY-WORD! types with caret, replace CR/LF/SP, /- becomes /| => Escaping in ANY-WORD! types with caret, replace CR/LF/SP |
27-Feb-2015 15:54 | Fork | Description | Modified | - |
27-Feb-2015 15:53 | Fork | Description | Modified | - |
27-Feb-2015 15:51 | Fork | Description | Modified | - |
27-Feb-2015 15:49 | Fork | Description | Modified | - |
27-Feb-2015 15:48 | Fork | Description | Modified | - |
27-Feb-2015 15:47 | Fork | Ticket | Added | - |