pre-pre-...-pre-RFC: Long String literal support

Often, I have a long string literal (e.g. some sort of message). If the literal is long enough, I either have to let the line be really long (bad style) or break the string into two strings and concatenate them somehow. This is fairly annoying.

To improve ergonomics, I propose that we allow syntactically splitting string literals as follows:

let s = "a long string lit";
// should be equivalent to
let s = "a long" " string lit";
// or 
let s = "a "
        "long "
        "string "
        "lit";

This would allow long string literals to be broken over multiple lines and indented/formatted nicely.

The only parsing ambiguity I can see is for macros that already accept things like foo!("a" "long string lit").

Any feedback appreciated.

Why isn’t the current multiline string support sufficient?

let s = "a \
         long \
         string \
         lit";
1 Like

Oh, wow :stuck_out_tongue:

I didn’t know that worked. Thanks @sfackler!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.