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

Re: method calls on $self

Thread Previous | Thread Next
From:
Larry Wall
Date:
July 11, 2005 13:06
Subject:
Re: method calls on $self
Message ID:
20050711200600.GC22537@wall.org
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

and

    o++;

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.

Larry

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