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

Declaration of my() variables using symbolic referentiation

Thread Next
From:
Ingo Blechschmidt
Date:
May 21, 2005 04:23
Subject:
Declaration of my() variables using symbolic referentiation
Message ID:
loom.20050521T131335-957@post.gmane.org
Hi, 
 
am I correct in the assumption that the following is an error? 
  # Not in a BEGIN block 
  my $::(calc_varname()) = 42; 
 
I think so, as my() is a compile-time operation, but in this 
example, the variable name is not known until runtime, so I 
think this should be forbidden.  Correct? 
 
But: 
  BEGIN { 
    my $::(calc_varname()) = 42; 
  } 
I think this one is ok, as the compiler can invoke 
&calc_varname at compile-time, and therefore know the variable 
name at compile-time.  Correct? 
 
FWIW, I wouldn't mind BEGIN { my $::(...) } being disallowed, too 
(consistency). 
 
 
--Ingo 
 
--  
Linux, the choice of a GNU | self-reference, n. - See self-reference   
generation on a dual AMD   |  
Athlon!                    | 


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