develooper Front page | perl.perl6.language.objects | Postings from August 2000

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

From:
Piers Cawley
Date:
August 21, 2000 05:04
Subject:
Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)
Message ID:
m1itsvrpun.fsf@rt158.private.realtime.co.uk
Damian Conway <damian@cs.monash.edu.au> 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




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About