develooper Front page | perl.perl5.porters | Postings from January 2011

Re: [PATCH] use feature 'method'; (was Re: Proposal: "$->" forimplicit invocant)

Thread Previous | Thread Next
David Golden
January 20, 2011 12:15
Re: [PATCH] use feature 'method'; (was Re: Proposal: "$->" forimplicit invocant)
Message ID:
On Thu, Jan 20, 2011 at 2:28 PM, chromatic <> wrote:
>  * grabbing the optree *already generated* for the body of the sub
>  * creating a new lexical $self binding in that optree
>  * rummaging through every variable access in that entire optree to find $self,
> if it exists

This is why I was pondering a "self" keyword.  If it could access the
right reference at runtime you wouldn't need to worry about the
existing bindings.


   * method { ... } somehow marks the subroutine body as a method
   * dispatch to such a marked method doesn't put the invocant in @_
but puts it "somewhere else" (big hand-waving here)
   * keyword self retrieves invocant from wherever it got put

I leave it to people who know the guts in detail to explain why that
is doomed to fail. :-)

-- David

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