develooper Front page | perl.perl6.language | Postings from December 2004

strictness and fully qualified global vars

Thread Next
From:
Alexey Trofimenko
Date:
December 28, 2004 19:55
Subject:
strictness and fully qualified global vars
Message ID:
opsjq3t9wssspxk8@this
in perl5 C<use strict> doesn't save us from typo bugs in code like

   use strict;
   print $OtherPackage::erroneuos_name;

in perl5 C<our $var> auotovivifies ${__PACKAGE__ . "::"}{var} glob at  
compile time, so there's something one could check with C<exists>, but to  
do it manually is senseless.
And there are no globs in perl6..

So, what about perl6? would it be possible to require declaration of  
global vars before their first use, even if vars in question are in other  
package? would it be default behaviour?

hmm, I wonder, is there any sense in C<our $Package::var> in that case.

P.S. I have one (almost unrelated to topic) observation: if sigil is a  
part of a variable name, then C< Package::$var > makes more sense than  
perl5 C< $Package::var >. (AFAIK, PHP5 works this way) And this requires  
less magic from perl.
On the other hand it's considerably harder to interpolate that..

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