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

Re: strictness and fully qualified global vars

Thread Previous
From:
Larry Wall
Date:
January 4, 2005 10:56
Subject:
Re: strictness and fully qualified global vars
Message ID:
20050104185558.GA4155@wall.org
On Tue, Dec 28, 2004 at 10:31:37PM -0800, Ashley Winters wrote:
: On Tue, 28 Dec 2004 22:31:47 -0700, Luke Palmer <luke@luqui.org> wrote:
: > Ashley Winters writes:
: > > sub foo (Class $who) {
: > >     my $thing := $who<$var>;
: > >     my &func := $who<&func>;  # how would I do this otherwise?
: > > }
: > 
: > In current Perl 6:
: > 
: >     sub foo (Class $who) {
: >         my $thing := $::($who)::var;
: >         my &func  := &::($who)::func;
: >     }
: 
: Okay, I see. S10 says ::() is the catch-all symbolic naming syntax.
: However, $who would be a reference to a class object itself. Does it
: automagically accept hard-references, or would Class objects have to
: stringify to their global ::*::ClassName?
: 
: More to the point, is %::(%foo) an identity op?

We will probably make hard refs work inside ::() just to make it easier
to translate Perl 5 to Perl 6.  But possibly it should require a laxity
pragma to enable it.  If we end up with people simply writing $::($x)
everywhere instead of ${$x}, we haven't gained anything over Perl 5,
and we've lost strict refs.  I don't want people to get in the habit
of using ::() for hard refs unless they explicitly want symbolic refs
as well.  I was hoping that the mere length of $::() over ${} would
be enough to discourage that kind of thinking, but now I'm not so sure.

Larry

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About