Raw string literals and Unicode escapes
Brian Goetz
brian.goetz at oracle.com
Fri Feb 23 21:00:31 UTC 2018
>
> However, since the JEP's goal is to allow copy-paste of arbitrary text
> without interpretation, I think the RawSP trick of assigning meaning
> to whitespace is out of place. To most people, the raw string literal:
>
> ` and `
>
> denotes a perfectly good five-character string that will probably be
> inserted between two other strings. Explaining that, no, it's really a
> three-character string will not be popular.
+100. The RawSP trick is clever, but too much so. There are ample
simpler approaches for beginning/ending with BT:
String s = BACKTICK + `a raw string` + BACKTICK;
String s = `` `a raw string` ``.trim();
These move the cognitive load on the user to the corner case, rather
than landing it on the general case.
More information about the amber-spec-experts
mailing list