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

[email protected] (Graham Barr)
Newsgroups perl.perl6.language.objects
Message-ID <[email protected]>
On Sat, Aug 19, 2000 at 09:32:50AM -0700, Randal L. Schwartz wrote:
> >>>>> "John" == John Siracusa <[email protected]> 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.
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.