To align, or not to align?
John Rose
john.r.rose at oracle.com
Thu Apr 18 20:59:53 UTC 2019
On Apr 18, 2019, at 12:31 PM, John Rose <john.r.rose at oracle.com> wrote:
>
> I think it's hard to make these be more convenient (readable,
> editable) than Jim and Brian's rules for stripping. They definitely
> have an "opt-in" feel to them, because of their extra overheads.
To clarify this paragraph: I mean that a syntax like the
__NWC_BLOB__ has an "opt-in" feel. Jim and Brian's rules
for stripping do *not* have such string "opt-in" feel,
and they have less overhead. With less overhead comes
more ambiguity; that's always the trade-off. But the
stripping rule which says "strip the most whitespace
possible, but equally from all lines" makes for a notation
that is very convenient and natural, perhaps enough so
to be "opt-out" instead of "opt-in".
I suggest that an easy "opt-out" for stripping would be
to throw in an extra escape somewhere that disables
the stripping machinery, either partially or totally.
The *simplest* way to do this is to replace the first
payload space on the first line with the escape \040,
which denotes an ASCII space, but cannot be confused
with stripped indentation. (Or can it? It shouldn't,
although I suspect it does in the present implementation.
Let's check the spec to make sure. And what about
\u0020??? Yikes. That's a real space under a unicode
escape, which is processed differently from an octal
escape.)
Another easy "opt-out" is to transfer the first line
(with retained indentation) to the line containing
the open-quote.
Another not-so-easy "opt-out" would be allowing
the sequence BACKSLASH NEWLINE to be elided,
as /bin/sh does. This is not in Java. If added, it
create (a) a way to break very long lines without
resorting to "+" operators, and (b) a way to opt
out of stripping, by placing BACKSLASH NEWLINE
immediately after the open-quote. And so on…
there are lots of ways to skin the cat if we allow
ourselves to give him new appendages. (And
consider a toroidal cat…)
— John
More information about the amber-spec-experts
mailing list