develooper Front page | perl.perl6.language | Postings from April 2003

Re: Properties & Methods

Thread Previous | Thread Next
From:
Luke Palmer
Date:
April 9, 2003 07:45
Subject:
Re: Properties & Methods
Message ID:
ygck7e3ybkx.fsf@babylonia.flatirons.org
> Urk!
> 
> So we're doing object access, but the namesearch looks like:
> 
> $root.visited -> in lexical scope as property? 
>               -> in object property namespace? (see next; order?)
>               -> in object method list?        (see prev; order?)
>               -> in class method list?  (??)
>               -> in multi namespace?
>               -> in package sub namespace?
>               -> in global sub namespace?
>
> 
> Right?

No.  One more time:

    my $visited = new Property;
    #                              v
    die "Already visited" if $root.$visited;
    #                              ^

See that $ after the . ?  It's like a dynamic method call, except it
knows it's looking for a property because $visited is a property
object, instead of a method object.  It has just as many problems with
closures as dynamic method calls do: none.

Oh, and named methods come before named properties in the lookup list.
And, in light of this explanation, the "lexical scope as property"
shouldn't be there.

Luke

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