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

Re: ./method

Thread Previous | Thread Next
From:
Abhijit Mahabal
Date:
May 15, 2005 07:11
Subject:
Re: ./method
Message ID:
Pine.LNX.4.62.0505150858440.22428@sluggo.cs.indiana.edu

> (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).

Comments?

--abhijit

Abhijit Mahabal      http://www.cs.indiana.edu/~amahabal/

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