develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [perl #21321] local ${"FOO"} does not work

Thread Previous | Thread Next
From:
Mark Jason Dominus
Date:
February 21, 2003 09:26
Subject:
Re: [perl #21321] local ${"FOO"} does not work
Message ID:
20030221172605.20299.qmail@plover.com

Enache Adrian <enache@rdslink.ro>:
> > > Mark-Jason Dominus:
> > > Perhaps the best way to address this would be to extend the peephole
> > > optimizer to optimize ${"COMPILE_TIME_CONSTANT"} to
> > > $COMPILE_TIME_CONSTANT.
> > 
> > Yup, something like that.
> 
> This cannot go without making lexical variables accessible through
> symbolic references.
> 
> I don't think it would be acceptable that '$a="b"; $$a' and '${"b"}'
> work differently ( since ${"b"} would be optimized to $b, it will
> access the lexical in the first place, unlike $$a ).

No, it will not.  It will do what it is programmed to do; it should be
easy to arrange for ${"b"} to be optimized to access the global
variable $b regardless of whether there is a lexical $b in scope or
not.


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