RFR: JDK-8198986 - 3.10.7: Raw string literals

Stephen Colebourne scolebourne at joda.org
Tue Mar 13 23:36:10 UTC 2018


On 13 March 2018 at 23:10, John Rose <john.r.rose at oracle.com> wrote:
> While you say you would prefer to hunt through
> the body of the string looking for doubled backticks,

No, I expect my IDE to double the backticks when I paste. In the
unlikely event that there are backticks.

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

The proposal as it stands has far more puzzlers.

* getting the count of backticks mismatched at start/end
* no ability to have an empty raw string
* no ability to start/end the raw string with a backtick
* adding backticks in the middle always requires checking to see if
the boundary is long enough

The much simpler single backtick proposal has none of these flaws.

> 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.

I get why it appeals to a language designer. However it is my view
that practising developers would disagree. Dealing with a simple
escape mechanism is considerably preferable to remembering the laundry
list of weird rules currently proposed.

Stephen


More information about the amber-dev mailing list