develooper Front page | perl.perl6.language | Postings from April 2005

Context of hash slices; quotation adverbs

Thread Next
Roie Marianer
April 17, 2005 10:09
Context of hash slices; quotation adverbs
Message ID:
Hi all,
I'm back with more quoting construct madness.

First, context of hash slices:
Hash slices with {} notation are trivially either scalars or lists:
 $h{'foo'} = want(); # Scalar
 $h{'foo','bar'} = want(); # List

With <> notation the same thing happens:
 $h<foo> = want(); # Scalar
 $h<foo bar> = want(); # List

But when you start interpolating, you get into a big mess:
 h<\qq[$interpolated]> = want(); # ???
 h<<$foo>> = want(); # ???

Secondly, quotation adverbs (S02) that take arguments could theoretically be 
variables that only exist during runtime
 q:c(rand) (Do we interpolate {this}?)
(It would be even worse if "this" had a closing paren in it)
That's complete madness, but with regexps it makes complete sense - sometimes

The general problem is that some adverbs affect parsing, while others take 
place only during runtime - and they all have the same syntax. I'll think a 
bit more myself about how to solve this, but I thought I'd throw it out there 
as well.
[ ]

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About