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

Re: ./method

Thread Previous | Thread Next
From:
Juerd
Date:
May 15, 2005 07:25
Subject:
Re: ./method
Message ID:
20050515142516.GJ18368@c4.convolution.nl
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 $__
        }
    }

and

    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?


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

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