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

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

From:
Damian Conway
Date:
August 19, 2000 13:04
Subject:
Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order forany hash)
Message ID:
200008192004.GAA03805@indy05.csse.monash.edu.au
From his padded room, Randal suggested:

   > >>>>> "John" == John Siracusa <siracusa@mindspring.com> writes:
   > 
   > John> I don't like $ME either, but my alternative is probably even more
   > John> blasphemous: use $self.  
   > 
   > John> But wait, it gets worse:  I'd even be happy with the bareword "self"
   > 
   > I'll have an adjacent cell.  I actually like that *better* than $self.


You can have your cake, but not force us to eat it too...

Like $AUTOLOAD, $ME would be dynamically scoped:

	package LoonyBin;

	sub self {$ME};

	sub get_polite_age : method {
		return (self->age >= 40) ? 39 : self->age;
	}


One might even imagine a standard pragma that automatically creates
such things in any package with methods.

We seem to cope with $AUTOLOAD okay, without the need to:

	sub autoload : lvalue {$AUTOLOAD}

all the time.

Damian



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