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

Context of hash slices; quotation adverbs

Thread Next
From:
Roie Marianer
Date:
April 17, 2005 10:09
Subject:
Context of hash slices; quotation adverbs
Message ID:
200504171954.18679.roiem@actcom.co.il
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
 rx:nth($n)/something/;

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.
-- 
-Roie
v2sw6+7CPhw5ln5pr4/6$ck2ma8+9u7/8LSw2l6Fi2e2+8t4TNDSb8/4Aen4+7g5Za22p7/8
[ http://www.hackerkey.com ]

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