On Friday 15 April 2005 3:27 am, Larry Wall wrote:
> On Fri, Apr 15, 2005 at 03:27:27AM +0300, Roie Marianer wrote:
> : > %hash<< a $key_b c >> :key<< a $value_b c >>
> : > %hash� a $key_b c � :key� a $value_b c �
> :
> : Just to be certain, these are both equivalent to
> :
> : @hash{'a', $key_b, 'c'} key => ['a', $value_b, 'c']
> :
> : in Perl 5, right?
>
> Close. It's actually more like:
>
> @hash{split " ", "a $key_b c"} key => [split " ", "a $value_b c"]
I actually knew that, but in my head $key_b and $value_b were single words.
But according to S02, the interpolation is protected by quotes. That is, if
$key_b is q0/printf "Hello, world\n" or die"/, that's four words, correct? Or
is it just if the quotes actually appear in the quoting construct? Basically
I'm wondering if there's a detailed specification of how <<>> should work.
Several only-slightly-related questions about interpolating:
1. qq x$varx eq $var? (That's how it works in Perl5, anyway)
2. If the delimiter is not a single character (I think this only applies to
<<>>), does a backslash protect the first character or both? For example, in
<<some words \>>> or die
Is that three words ['some', 'words', '>'] with the >> ending the construct,
or is that ['some', 'words', '>>>', 'or', 'die']? (and the rest of the file
is interpolated and split into words)
3. Are <<>>-style delimiters allowed in other quoting constructs? Is
q<<Hello>> the string "Hello", or the string "<Hello" followed by the
greater-than sign? (As you can probably tell, I haven't implemented <<>> yet
at all.)
My head hurts. :-)
By the way, something tells me perl6-compiler isn't the best place for this
discussion. Is there a secret group of people that discusses cornercases for
perl6, and if so could someone tell me on what list they live?
--
-Roie
v2sw6+7CPhw5ln5pr4/6$ck2ma8+9u7/8LSw2l6Fi2e2+8t4TNDSb8/4Aen4+7g5Za22p7/8
[ http://www.hackerkey.com ]