On Thu, Sep 14, 2000 at 02:51:14PM -0700, Glenn Linderman wrote:
> Michael G Schwern wrote:
> Well, OK, so now we're talking shades of opinion. You'd agree it
> works, though, and quite effectively. But you'd disagree about its
> aesthetics, and its performance. The former is much less
> interesting to me than the latter.
Here-docs are all about aesthetics. Otherwise, we'd just be using
regular strings.
> That's fair, except that they aren't equivalent: you'd need
>
> die
> ' The old lie'."\n".
> ' Dulce et decorum est'."\n".
> ' Pro patria mori.'."\n";
Just to be silly...
die join "\n",
' The old lie',
' Dulce et decorum est',
' Pro patria mori.','';
> Which is somewhat worse, compared to the here doc, even with "!" or
> other leading demarcation of choice (your choice, is, of course,
> none).
They're all yicky.
> > I'd prefer if here-docs just DWIM.
> Yes, but... what do you mean vs. what do others mean, and all these
> problems....
Others can continue to put the here-doc tag flush left if they don't
want this behavior. I'd like to keep it clear that I consider all the
proposals orthoganal, each solving a different (yet often overlapping)
set of problems.
> This leads me down another path: wouldn't it be nice to have a
> function to interpolate a string on demand?
Whoa! Hey, yes, great idea! Not so much for his problem, but I can
definately see a need for anyone that's writing any sort of templating
system.
> Then you could hoist the here-doc processing above out of the loop,
> and still get the effects of interpolation inside the loop, which
> would make the performance of here-doc postprocessing much less
> critical... but this means defining variables to hold the
> intermediate results, and moving the here-doc to a different
> location, which might not be as friendly to the understanding of the
> script.
Right. Moving the text away from the point where it is used has
maintenance problems.
PS Do you use 132 columns to write mail?
--
Michael G Schwern http://www.pobox.com/~schwern/ [EMAIL PROTECTED]
Just Another Stupid Consultant Perl6 Kwalitee Ashuranse
Sometimes these hairstyles are exaggerated beyond the laws of physics
- Unknown narrator speaking about Anime