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

Re: ./method

Thread Previous | Thread Next
Abhijit Mahabal
May 15, 2005 07:11
Re: ./method
Message ID:

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

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



Abhijit Mahabal

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