Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)

[email protected] (Piers Cawley)
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
Damian Conway <[email protected]> writes:
> Errr. I would imagine that $ME contains:
> 
> 	* a reference to the object, within an object method
> 
> 	* the name of the class, within a class method
> 
> 	* a reference to the *subroutine* itself, within a non-method.

Ooh, recursive anonymous subroutines 'r' us: 

    sub factorial {
        sub {return $_[1] if $_[0] <= 0;
             $_[1] *= $_[0]--;
             goto &$ME}->($_[0], 1);
    }

I wonder if this counts as a Good Thing.

-- 
Piers
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.