Re: RFC 152 (v1) Replace $self in @_ with self() builtin (not $ME)

[email protected] (Nathan Wiger)
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
Damian Conway wrote:
> 
> My forthcoming proposal will be that invocants still be passed as $_[0]
> by default, but that there be a pragma allowing $_[0] to be automagically
> shifted somewhere else during dispatch. For example:
> 
>         use invocant '$ME';
>         sub method { print "I was called through: $ME";
>                      print "My args were: @_";          }

What don't you like about the current RFC? What specific problems are
there? I would urge you to read through the thread some.

The RFC notes you can call self() anywhere, allowing you to arbitrarily
encapsulate code. I don't see how a pragma could do this.

How is your idea any better than:

   sub method {
      my $ME = self;
   }

And why is passing $self in $_[0] a good thing? 

If we're going down the prama path, I say we get rid of want() and
instead have a pragma:

   use want '$WANT';
   sub method {
       if ( $WANT eq 'HASH' )  { ... }
   }

This seems just as silly to me. We have caller(), want(), why not
self()?

-Nate
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.