On Mon, 9 Sep 2002, Andrew Wilson wrote: > On Mon, Sep 09, 2002 at 02:14:25PM -0500, Me wrote: > > Hence the introduction of let: > > > > m/ { let $date := <date> } / > > > > which makes (a symbol table like entry for) $date available > > somewhere via the match object. > > Somewhere? where it appears in in the namespace of the caller. > Apparently there is no way to use someone else's grammar and prevent it > trashing your namespace.
Err.. I don't think so. # Date.pm grammar Date; my $date; rule date_rule { $date := <something> } # uses_date.p6 (hmm.. I wonder what a nice extension would be...) use Date; my $date; m/ <Date::date_rule> /; This would mess with $Date::date, not $main::date. If there was no $Date::date, it wouldn't mess with anything, and it would store the return value of <something> in $0{date}. I'm talking about just in the same namespace, how do we keep rules from messing with file-scoped (or any-scoped, for that matter) lexicals or globals. How do we get rule- or closure-scoped lexicals that are put into $0? Which of these are legal, and would provide a solution? / <something> { let my $date = $something } / / <something> { $0{date} = $something } / If either, I guess I have no complaints. I'll be angry if the latter isn't legal. Still, they seem a little bit hack-like.... Luke