RFR: JDK-8198986 - 3.10.7: Raw string literals

John Rose john.r.rose at oracle.com
Wed Mar 14 18:40:47 UTC 2018


On Mar 14, 2018, at 11:23 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> Picking a fixed number of ticks, plus an escaping rule, may make it less likely
> you have to do fixups, but ultimately just moves the problem down the road.

…where in terms of my previous message "the problem" is having to read
through the bulk of the string for escapes, instead of consulting the edges only.

One mental test that I have for these designs is to ask what a programmer
would experience when nesting Java source code inside of Java source code.
This is a stress test, but a significant proxy for embedding other random
language in Java source code.  Any fixed limit to the number of quotes also
puts a fixed limit to nesting depth.  Again, not that we want programmers to
do deep nesting, but an arbitrary limit is a sharp edge, and the smaller the
sharper.

In practice, as Brian said, people won't often abuse the notation, except to
win obfuscated code contests.  It's easy to find abusable points throughout
any language design, but "abusus non tollit usum".

   int o0olo1o0 = 01_01;  // abusus  
   int n = 5;  // what people really write

http://merriam-webster.com/dictionary/abusus+non+tollit+usum <http://merriam-webster.com/dictionary/abusus+non+tollit+usum>

— John


More information about the amber-dev mailing list