String reboot (plain text)

Liam Miller-Cushon cushon at google.com
Fri Mar 15 18:49:07 UTC 2019


On Wed, Mar 13, 2019 at 12:57 PM Brian Goetz <brian.goetz at oracle.com> wrote:

> To the “indent is good enough” point: Auto reflow is a disaster when
> applied to mixed spaces and tabs; while in general one should avoid this, I
> cannot rule out the possibility that someone might actually want to embed
> such a snippet; in that case, truly raw strings are an option.  If we take
> away truly raw, now they just have two bad approximations.
>

What do you think is the best framework for evaluating that trade-off?

The issues with leading spaces and tabs may be severe but should be
extremely rare. The issues with manually managing leading indentation are
less severe, but also very common.

If the leading indentation feature considers the closing delimiter position
(as some of the earlier proposals did), it's easy to explicitly keep the
leading whitespace and avoid collateral damage even with mixed spaces/tabs:

  void f() {
    String hello = \"""
        all leading whitespace is preserved
        even with a mixture of tabs and spaces
"""\; // (the closing delimiter is un-indented to the margin, forcing
leading whitespace to be kept for the other lines)
  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190315/b48d0d86/attachment.html>


More information about the amber-spec-experts mailing list