-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Current behavior
If a literal string has trailing spaces (U+0020), a `<string>` style literal removes all the trailing spaces while a `<string>`# retains all.
On the other hand, if a literal string has trailing line breaks a `<string>` style literal removes only one trailing line breaks and a `<string>`# removes up to two of them. Neither removes spaces followed by the trailing line breaks.
This code
let display-message-with-boundaries str = display-message (`@` ^ str ^ `@`)
let _ = display-message-with-boundaries ```3LF+#
```#
let _ = display-message-with-boundaries ```2LF+#
```#
let _ = display-message-with-boundaries ```1LF+#
```#
let _ = display-message-with-boundaries ```3LF
```
let _ = display-message-with-boundaries ```2LF
```
let _ = display-message-with-boundaries ```1LF
```
produces the following result
@3LF+#
@
@2LF+#
@
@1LF+# @
@3LF
@
@2LF @
@1LF @
I summarize the result in the following table where ⏎ represents a line break character (U+000A) and ␣ a space (U+0020).
| Literal | Interpreted |
|---|---|
`a␣⏎`# |
a␣ |
`a␣⏎⏎`# |
a␣⏎ |
`a␣⏎⏎⏎`# |
a␣⏎⏎ |
`a␣⏎` |
a␣ |
`a␣⏎⏎` |
a␣ |
`a␣⏎⏎⏎` |
a␣⏎ |
`a␣⏎⏎⏎⏎` |
a␣⏎⏎ |
Expected behaviors
I would expect one of the following options:
-
Both trailing line breaks and spaces are equally treated. I.e.,
`string`#style literal preserves any trailing line breaks or spaces while`string`#style trims all the trailing line breaks and spaces.For example,
`a␣⏎␣⏎`#and`a␣⏎␣⏎`will representa␣⏎␣⏎anda, respectively. -
When there are trailing line breaks following spaces, the spaces won't be removed.
`string`#style literal preserves all the trailing line breaks while`string`#style trims all the trailing line breaks.
For example,
`a⏎⏎⏎`#and`a⏎⏎⏎`will representa⏎⏎⏎anda, respectively.`string`#style literal preserves up to one trailing line break while`string`#style trims all the trailing line breaks.
For example,
`a⏎⏎⏎`#and`a⏎⏎⏎`will representa⏎⏎anda, respectively.
Original comment: https://satysfi.slack.com/archives/CTGUT75FZ/p1584115832024200
Metadata
Metadata
Assignees
Labels
Projects
Status