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

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

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
February 20, 2003 22:26
Subject:
Re: [perl #21321] local ${"FOO"} does not work
Message ID:
20030221062556.GA27176@kosh.hut.fi
> > > Bleadperl or 5.8.0:
> > > 
> > > $ ./perl -e 'local ${"FOO"}=1'
> > > Can't localize through a reference at -e line 1.
> > > $ 
> > > 
> > > What reference where?

> > Ronald J Kimball <rjk@linguist.Thayer.dartmouth.edu>:
> > That's a symbolic reference, isn't it?

Syntactically yes, but semantically it isn't, all that needs to be
known about the variable name is known in compiletime.  In other
words, I would have expected the above to be equivalent to ${FOO}
or $FOO.

> 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.

-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

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