develooper Front page | perl.perl6.language | Postings from December 2004

Re: Angle quotes and pointy brackets

Thread Previous | Thread Next
From:
David Green
Date:
December 1, 2004 00:21
Subject:
Re: Angle quotes and pointy brackets
Message ID:
plato-977A1A.01210701122004@x6.develooper.com
In article <20041130213536.GC30391@wall.org>,
 larry@wall.org (Larry Wall) wrote:
>Here's the proposal.
>First the bad news:
>    * We accept that the C<< < >> operator requires whitespace
>    around it, and be prepared to be burned in effigy occasionally.

I wouldn't go that far, although when I inevitably get burned by it, 
I might let slip some intemperate comparisons regarding whitespace and 
programming in Python...  =)

>    * That means that, roughly, we have this proportion:
>    '...' : "..." :: <...> : «...»

I wasn't sure at first, but I think you just sold me.  (I'm a sucker 
for parallels.)

>    * The :w splitting happens after interpolation.  So
>        « foo $bar @baz »
>    can end up with lots of words, while
>        « foo "$bar" "@baz" »
>     is guaranteed to end up with three "words".

Now I'm a bit lost.  I would've expected the quotes (") inside a 
different kind of quote («) to be taken literally (just as in 'foo 
"$bar" "@baz"' or qw/foo "$bar" "@baz"/).
I'm not even sure what those double-quotation marks are doing -- 
preventing $bar from being interpolated as a variable, or preventing 
the interpolated value from being white-split?

(Of course, to keep the pattern going, I'd propose < for no 
interpolation, << for interpolation (but not subsequent splitting), and 
introduce <<< for going whole-hog and interpolating *with* subsequent 
splitting.  (Not that I'm saying I'd actually ever use <<<triple 
quotes>>>, I just wanted to propose them for the parallelism.))

>    * A rule like <ident> now captures, while «ws» or <<ws>> doesn't.
>I think I really like that last outcome.  Capturing should be the default.
>And the low profile of «ws» makes it look like an "oh by the way".

I don't think I like that as much as you do.  I'm not sure I *dislike* 
it either... but I would be tempted to say that the double guillemets 
should do twice as much (identify AND capture).  That might be simply 
because I'm not used to it, though.  Either way, I know I really like 
being able to drop the parentheses when capturing like that.


Overall, I think the new proposal is an improvement.



                                                  -David «foo» Green

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About