Summarising Position On String #1989
Replies: 2 comments 1 reply
-
So the example looks like this:
What if we have to declare a list of string:
This doesn't look so good. What if we start using
And second example will become:
I think this looks better, especially for list of string example. We can also use
But considering table which will be introduced in 0.5 the syntax looks like this:
This is neat.
This is okay. But not so great as above. |
Beta Was this translation helpful? Give feedback.
-
@Arpita-Jaiswal: this is quite brilliant: |
Beta Was this translation helpful? Give feedback.
-
I was under wrong impression that to allow arbitrary syntax inside string formatting, e.g. string format expression itself containing string with formatting recursively, we will need to keep track of double quote depth (how deep are we in double quotes / format recursion). So we will need
[]
where we have explicit count up and count down. Same symbol for both open and close does not let us keep track of depth.But I was wrong because to go from string to expression, we have to use
${}
or{}
expression, and we can just keep track of the curlies for counting depth (number of open{
brackets till now tells us how deep in recursion we are).So now we do not have any strong reason to prefer
"
quoted string vs$[]
strings.There is one minor difference still, we want our strings to "indoc strings" by default:
And we want another way to represent a string which leaves spaces intact. With indoc it is done by leaving normal space preserving string to
""
, and making the "idocification" explicit by theindoc{}
macro.We want it to be default. We can say our
""
will indocify, andr""
for space preserving version. But in Rustr""
prefix is used for a totally different purpose, which I do not wnat to "appropriate".So I feel
$[]
, the indocifying version, vs$$[]
, the space preserving version is the way to go. rationale: it looks better to me.Beta Was this translation helpful? Give feedback.
All reactions