SE-0200: "Raw" mode string literals

  • It's not clear to me what is "raw" about this string representation. I get that it's raw in the sense of being uninterpreted, or unescapable, or whatever word describes it, but I think "raw" tends to suggest some numeric sequence, such as code units.

  • All the syntax seems kind of arbitrary and desperate. It's another of those scenarios where using words to spell out the meaning is clear but too much, and using special symbols is perpetually obscure.

We already have some arbitrary and desperate string syntax: multi-line literals. Is there some reason we couldn't recycle that approach? For example:

    print ("""a\bc""") // prints: a\bc

The compiler can currently recognize both these triple-" delimiters (it gives me explicit errors about why this is a malformed multi-line literal). Now that those are part of the language, single-line "multi-line" literals might not be too scary.

That syntax would largely eliminate the problem of not being able to have literal quotes:

    print ("""a\"b"c""") // prints: a\"b"c

The only exclusion from string contents would be triple-" substrings and line endings, for which a true multi-line multi-line literal would be the solution.

1 Like