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:
Bryan C . Warnock
Date:
August 19, 2000 22:32
Subject:
Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order for any hash)
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
(bwarnock@gtemail.net)



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