RFR: JDK-8198986 - 3.10.7: Raw string literals

John Rose john.r.rose at oracle.com
Tue Mar 13 23:10:56 UTC 2018

On Mar 13, 2018, at 3:59 PM, Stephen Colebourne <scolebourne at joda.org> wrote:
> Simple, straightforward, and far more in line with expectations (and
> much easier for pasting code in/out).
> Please can we stop the backtick repetition craziness now!

We considered your proposal and decided against it.
You are moving the craziness around, not removing it.
The pigeonholing principle prevents means there has to
be an escape or special syntax somewhere, and you
are putting it into the body of the string, wherever
a backtick occurs (you double it).  We have decided
to keep the special syntax completely outside of
the pasted string body.  In essence, the doubled
backticks are forced into the boundary of the string
body.  While you say you would prefer to hunt through
the body of the string looking for doubled backticks,
I think most folks will be relieved that they can
quickly spot the boundaries of the string, no matter
how baroque, and then read the string body forgetting
that it is inside some other container.

You correctly observe that this sort of thing is a
rich source of puzzlers.  Again, that is true no
matter what we do.

I think in low-level syntax questions like this there
will always be some of us (unfortunately you in
this case, sorry!) who are repulsed by the decision.
It's natural to make the mistake of fleeing to some
other choice but failing to see the downsides that
other choice.

In this case, the trade-off is to let the backticks
pile up on the edge of the string, in order to
allow them to exist undisturbed in the interior.
An edge effect is always smaller than a bulk
effect, or large bulks.  Hence our design.

— John

More information about the amber-dev mailing list