To align, or not to align?
brian.goetz at oracle.com
Thu Apr 18 18:32:47 UTC 2019
> - It is not an orthogonal decomposition; we're tying ML-ness to
> alignment. The language should expose primitives that the user can
> combine compositionally.
> Interesting! I think this is exactly opposite to what's really going on.
> Here's how people think of their program indentation. When I open a
> block, I increase it by N. When I close a block, I decrease it by N.
> Continuation line, maybe +2N. I move in and out based on what's
> happening locally. However, I have no care at all for what the
> current absolute value of that indentation is. Maybe it's 10, maybe
> it's 14, whatever; that value is irrelevant to me, it simply emerges
> from how nested I happen to be.
> Indentation stripping is precisely what *preserves* that independence.
I don't disagree, as much as see two different ways of looking at it,
and I want to call those out explicitly so we can be clear on what we
think the language actually wants. And I think that duality of
perspective is exactly the question that we need to come to terms with.
One view is that a string literal is the sequence of characters between
the delimiters, and a multi-line string literal is just a string literal
that happens to be able to span lines. This is also the simplest
extension of existing string literals to multi-line; adding only the
ability to span lines. In this view, implicit alignment can feel like
conflating two things.
An alternate view is that a multi-line string is a literal that is
embedded spatially in the Java source code; therefore it inherently has
some 2D structure to it, which gives us permission to muck with it in
certain ways that are consistent with that structure.
Guy further observes that these two views are both extremes, and there
is another option in the middle: that a multi-line string literal is
neither merely a sequence of characters, or a 2D text block to be
trimmed according to an algorithm, but actually a small program in
"spatial string literal language" that can be expressive enough to talk
about its structure, and therefore can be more explicit about its
So I think the question really comes down to: what _is_ a multi-line
More information about the amber-spec-observers