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

Re: ./method

Thread Previous | Thread Next
From:
Fagyal Csongor
Date:
May 15, 2005 07:26
Subject:
Re: ./method
Message ID:
42875B5E.9020800@conceptonline.hu
Abhijit Mahabal wrote:

>> (Note that "./" and "../" are prefix operators, and unlike ".?", ".*",
>> ".+" and ".=", cannot be used infix. In fact, it requires that "?", "*",
>> "+" and "=" be thought of as meta-operators to ".", and from now on, to
>> "./" and "../" as well, so you get "./+method". This isn't as complex as
>> it looks right now.)
>>
>> Your opinions please! (I ask those who already responded off-list, to
>> repeat their opinion here)
>
>
> Since new syntax is being suggested for these things, here is my 
> suggestion, very late in the discussion, but here it is anyway.
>
> $_ 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" $__?

> method foo($x){
>     # invocant accessible by both $__ and $_
>     for (1..3) {
>     # invocant accessible by $__ only
>     .bar(); # called on $_
>     $__.bat(); # called on the invocant
>     $?CLASS.bas();
>     }
> }
>
> 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).

Yep. I'd hate it to move the cursor every time on __ to see if it is _ 
or __. I have bad eyes and a small monitor :-)

This view won't be popular, but I'd prefer all these "built-ins" look 
like $_SOMETHING, like
$_, $_SELF, $_CLASS and so on...  even $_ to be an alias to $_TOPIC .

- Fagzal

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