we fixed the precedence of concatenation with respect to + (at your suggestion)

Thanks! And you're welcome. ;)

I like your first example. It is nice to have a "concat this list" option so compactly.

One of the things that I really learned to like about join '', ... is how low the precedence of comma is, so I don't have to put parens around even 'the ternary'. I agree that ?? :: should bind looser than concatenation but that also means I probably won't be doing direct concatenation of long lists of expressions. (Which is not a problem since there are better options.)

And the rest of the options are lovely.

Well, we fixed the indent part at least, though you're still on your own with trailing whitespace.

I'll have to review the lastest proposal on handling of indenting as I wasn't sold on some of the previous versions. But why don't you ignore trailing whitespace after the delimiter? I've decided that it is almost always better to do s/\s+$// over chomp because trailing whitespace is invisible and really deserves to be ignored. Tell me which line has the extra leading space and which one has the extra trailing space:

LINE LINE LINE LINE LINE

Sure, you can do it, if you know to look specifically for it, but it just sucks to have things that break due to such. At the very least, Perl 6 should shout "I noticed you had trailing whitespace after what would have otherwise ended your here-doc, but I didn't ignore it and that is probably why I couldn't find the end of your string". (:

Is there some value to allowing trailing whitespace to make the delimiter not the delimiter? The only value I come up with is a way to include something that looks like the delimiter in the output. I'd much prefer that be done in a much more visible way. Using such a subtle trick deserves a comment pointing out what is going on. But it is worse because (having worked even in a small company where my editor actually shows me trailing whitespace) I know that lots of editing situations don't give trailing whitespace much respect. Lots of things strip it or add it with little justification.

Surely, several of the above interpolation techniques would be better methods for including a line equal to the delimiter in the here-doc:

my $string= <<END; You end your here-doc with a line like: {''}END but be sure to prevent any trailing whitespace from sneaking in! END

What purpose am I missing?

- tye        


In reply to Re^3: Perl style: Arguing against three-argument join() (Perl 6) by tye
in thread Perl style: Arguing against three-argument join() by martin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.