Raw string literals and Unicode escapes

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Feb 26 21:29:31 UTC 2018

On 26/02/18 20:17, John Rose wrote:
> Any*finite choice*  of end-quotes has the same problem, with
> a non-zero probability that decreases (but does not vanish)
> with the number of available end-quotes.  The only way to
> break out of the box is to allow the user an unlimited range
> of successively "stronger" end-quotes (i.e., less likely ones).
In reality there is a 'finite' upper bound for this length, which is 
given by 2^16 /2 = 2 ^ 15. That's the maximum delimiter size you could 
encode in a Java String which you can also symmetrically close - and 
it's an edge case, as it will contain the empty string.

So, yes, on paper, I agree with the argument, in practice, I guess I'd 
me more in favor of limiting the number of repetitions - I wouldn't like 
to open the door to puzzlers:


(which might leave some Ascii art lovers a bit unhappy :-))

I think limiting to 8 or some other reasonable small number will 
probably reduce the clash probability enough? And, even if it's not 
enough, I guess we'd still be left with the question if a long (possibly 
unbounded?) escaping sequence is something we'd like to see in Java.


More information about the amber-spec-observers mailing list