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:
Graham Barr
Date:
August 20, 2000 07:39
Subject:
Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)
Message ID:
20000820081151.M27447@pobox.com
On Sat, Aug 19, 2000 at 09:32:50AM -0700, Randal L. Schwartz wrote:
> >>>>> "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.  "It usurps a variable name that has been legal for
> John> customer use in prior Perls!" you re-exclaim.  Not if it only appears in a
> John> new-to-Perl-6 construct like:
> 
> John> method get_polite_age(<neat stuff could go here>)
> John> {
> John>   return ($self->age >= 40) ? 39 : $self->age;
> John> }
> 
> Well, that I could support.  Although having the p52p6 translator
> recognize which subs should really be methods might be a bit messy,
> and then it'd have to recognize any uses of $self for a proper $self,
> and not shift something into that, or whatever. :)

It would not have to. Any sub defined as 'sub' and called as a method
could be called using the current convention. Only those marked as methods
would have $ME (or what ever)

What I would like to see also is that if a sub marked as a method is
called as a sub, then this magical var is undef.

Graham.



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