String reboot (plain text)
Brian Goetz
brian.goetz at oracle.com
Fri Apr 5 19:52:39 UTC 2019
Indeed so. While many languages have been content to treat ML as a
special case of raw, there's something somewhat odd and forced about
lumping them together. Of course, splitting has its overheads too --
but I think there is a path here to identifying the right dimensions of
parameterization where we can have one feature, simply parameterized.
The first dimension here is what to do about line spanning; the
thin-vs-fat delimiter seems a good enough way to split that out, but
there is still lots to talk about regarding accidental indentation and
terminator normalization (1A) -- before we even get to raw-ness (2).
But so far, teasing out ML as its own axis (which isn't fully finished)
looks promising, and I like that these string literals are recognized as
merely another flavor of the same basic feature. Happy so far.
On 4/5/2019 2:12 PM, Alex Buckley wrote:
> As someone who was nervous about how raw string literals effectively
> sidelined Unicode, I'm pleased that \uXXXX escapes are back. It's also
> great that the traditional escape sequence \" will be interpreted as a
> single " like it would be in a traditional string literal. Because, as
> we all know, the code above started life as this painful noisy code:
>
> String result = "public class Main {\n" +
> " public static void main(String... args) {\n" +
> " System.out.println(\"Hello World!\");\n" +
> " }\n" +
> "}\n";
>
> Now a developer can move forward in steps: today remove all the
> end-of-line cruft involving \n and + that multi-line strings do for
> free, and don't worry about mid-line escape sequences such as \" --
> convert them to " tomorrow, or next week, or not at all, your choice.
>
> Alex
More information about the amber-spec-experts
mailing list