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

[email protected] (Bryan C . Warnock)
Newsgroups perl.perl6.language.objects
Message-ID <00081923473900.00760@CC789569-A>
On Sat, 19 Aug 2000, Randal L. Schwartz wrote:
> I'll have an adjacent cell.  I actually like that *better* than $self.
> Let's not stop there though.  Perhaps we need "self" and "super" and
> "thisContext".  Only half joking... this would solve a lot of the
> hacking issues.  self could be a "die" if we weren't called as a
> method, and then we wouldn't need to have a separate "method" type.
> Oooh.  Getting better all the time!  Or maybe just return undef, and
> let the method call fail on the undef, or we could check it ahead:
> 
>         if (my $me = self) {
>           $me->do_this
>         } else {
>           $CGI::Q->do_this
>         }
> 
> To steal from CGI.pm's problem.  Or, if it threw an exception:
> 
>         try {
>           self->do_this
>         } error {
>           $CGI::Q->do_this
>         }
> 
> or whatever the syntax is this week.

Given the above examples, how many other things would break if $ME/self
were implicit, and automagically pointed to the right object or
package?  The above would be reduced to 

	do_this();  

in both procedural and object code.  


-- 
Bryan C. Warnock
([email protected])
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.