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

Re: ./method

Thread Previous | Thread Next
May 15, 2005 07:25
Re: ./method
Message ID:
Abhijit Mahabal skribis 2005-05-15  9:10 (-0500):
> $_ is the topic; the "only" problem is that we have two topics here: an 
> immediate and a "main" topic. What if a method call binds the invocant to 
> *both* $_ and the "bigger topic" $__?
> (...)
> I like this because things still look a little like a topic. This is not 
> better than $o/$O, except that $__ looks more like $_ (but maybe it looks 
> too much like $_, and that alone could invalidate this proposal).

I do think $__ looks too much like $_. A bit better would be to not have
a "bigger" topic, but a "higher" topic, $-, but the problem with seeing
the invocant as a topic on another level, is that
inconsistency/asymmetry would be introduced between

    method {
        # topic is object
        given 5 {
            # topic is 5
            # "bigger" topic is object, we access it as $__


    given $object {
        # topic is object
        given 5 {
            # topic is 5
            # $object is neither $_ nor $__

For this reason, I think an alias for $?SELF should not visually
resemble $_.

I don't think an alias for $?SELF is needed, because the only thing you
usually do with it, is call to call a method. In the rare occasion that
you want to pass it around, $?SELF or explicitly signatured $self
suffices (and is the clearest way to write it IMO).

You didn't say what you think about ./method; What is your opinion?


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About