A raw string, or heredoc style syntax #379
Closed
itsgreggreg
started this conversation in
Language Development
Replies: 2 comments
-
I think it would be a good addition and it's not hard to implement personally I vote for the the triple quote syntax |
Beta Was this translation helpful? Give feedback.
0 replies
-
HEREDOC strings were implemented in newly released version 0.17.0. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would be nice to have a raw string syntax that consumed everything between its delimiters literally including quotes and newlines. Helps with including strings that would otherwise need a lot of escapes such as JSON strings or human writing.
Would be nice if it is the case that directly after the opening delimiter there is a newline, that newline isn't included in the output. Similarly if there is no content between the last newline and the closing delimiter, then that last newline is not included in the output.
So this string would contain exactly 1 new line character:
Could also be nice to have some sort of white space removal indicator, perhaps the location of the closing delimiter like in Crystal. So the const here would have no leading whitespace at runtime:
Syntax examples from other languages:
Elm
Elixir
Rust
Crystal
Beta Was this translation helpful? Give feedback.
All reactions