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

Re: method calls on $self

Thread Previous | Thread Next
Larry Wall
July 11, 2005 13:06
Re: method calls on $self
Message ID:
On Mon, Jul 11, 2005 at 11:14:18AM +0200, Michele Dondi wrote:
: Hmmm... I am one of those who likes ./ more, instead. I mean, I _really_ 
: like it! Thus, how about making '/' less meaningless, i.e. more 
: meaningful, in more general situations?!?

Um, do you have a specific proposal?  Like maybe / can be applied as a
metaoperator to any binary operator to make it into a unary operator
with the left side implicitly $?SELF, or some such?  Hmm...

    if ==/ 3	# if $?SELF == 3

could even extend it to postfix ops:

    ++/;	# $?SELF++

However, it has several problems.  First, "." isn't really a binary
operator, but the prefix of a postfix operator.  Second, the / is
potentially ambiguous with a following pattern unless we require
space before termish /.  Third, the / is psychologically in the wrong
place to stand in for something in front.  Or to turn these on their
head, we've just made three good arguments for something like:

    if o == 3



I'm afraid that, while ./ is cute and visually distinctive, I find
I'm getting tired of its idiosyncracies.  You shouldn't go out and
marry someone just because they're cute and visually distinctive.
Hooray for long engagements, and occasional disengagements.


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