perl6-language  

Re: method calls on $self

Larry Wall
Mon, 11 Jul 2005 13:06:12 -0700

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