Enhancing Java String Literals Round 2

Guy Steele guy.steele at oracle.com
Mon Jan 7 21:58:22 UTC 2019

> On Jan 7, 2019, at 5:13 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> 	\""•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?

It’s an empty string, because only \"" is followed by a nonce.

>    int i = “”.length() // am I invoking a method on the empty string, or using dot as a nonce?

The dot is not a nonce, because only \"" is followed by a nonce.

More information about the amber-spec-experts mailing list