# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #117603]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117603 >


<masak> I don't think we ever got an RT ticket for
http://irclog.perlgeek.de/perl6/2012-12-12#i_6236512
<masak> rn: https://gist.github.com/masak/5379061
<p6eval> niecza v24-37-gf9c8fc2: OUTPUT«Line 1␤Line 2␤Line 3␤Line 4␤␤»
<p6eval> ..rakudo 070f3a: OUTPUT«Asked to remove 4 spaces, but the
shortest indent is 0 spaces  in block  at /tmp/HZMtZbv4Ag:3␤␤Line
1␤Line 2␤Line 3␤Line 4␤␤»
* masak submits rakudobug

For context, here's the gist:

say qq:to/END/;
    Line 1
    {foo}
    Line 4
    END

sub foo { "Line 2\nLine 3" }

And here's the prior conversation in the backlog:

<masak> at some point I'd like us to have a deep discussion about
heredocs, indentation, and interpolation.
<masak> TimToady: should the indentation from an interpolated variable
figure in the de-indentation of a heredoc?
<masak> TimToady: S02 contains *one* example of qq:to, and that
example doesn't address the subtle question of what happens first:
.indent(*) or variable interpolation. what's your take on which one
happens first?
<TimToady> masak, jnthn: the intent is that heredoc indent is a
textual feature, not a shortcut for a run-time feature
<TimToady> yes it's harder, but STD does it that way (and so niecza, I think)
<jnthn> TimToady: That means...breaking the string up and indenting
each piece of it separately and knowing not to if the piece in
question doesn't contain a new line :/
<jnthn> I guess the AST already has it that way so it's "just" a bit
more post-processing.
<TimToady> jnthn: only a textual newline
<jnthn> TimToady: textual as in the source?
<TimToady> yes
<jnthn> TimToady: It's a pain and I think it's too clever for it's own
good. It's doable I guess.
<TimToady> it's what the user wants, not the implementor
<jnthn> As I user I like semantics I can easily grok
<TimToady> this is easy to grok
<jnthn> As a teacher I like semantics I can easily explain
<jnthn> "It forms the string and does what indent would do" is easy.
<TimToady> there's an artificial left boundary at that point
<TimToady> just move the line over
<TimToady> what you see is what you get, if you just moved the text
over to the left margin
<jnthn> Hm, true
<TimToady> it's visually the right thing to do
<moritz> is that boundary determined by the indention of the heredoc
terminator, or by the left border of the content?
<TimToady> terminator
<TimToady> heredoc indent is only for not forcing the user to outdent
heredocs like you have to do in p5
<TimToady> or however you say that in English
<TimToady> it's an aid to formatting code, is all

Reply via email to