Enhancing Java String Literals Round 2
brian.goetz at oracle.com
Mon Jan 7 22:13:07 UTC 2019
> \""•multiline, no escapes, cannot contain the nonce followed by two double quotes•""
> where ‘•’ represents a nonce string (the same string at each end), which has to be one of the following:
This is an interesting middle ground.
Off the top of my head, I would think we’d have to pretty seriously restrict the characters, so as to avoid parsing ambiguities:
String s = “”; … // is this an empty string, or using semicolon as a nonce?
int i = “”.length() // am I invoking a method on the empty string, or using dot as a nonce?
More information about the amber-spec-observers