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:
Bart Lateur
Date:
August 24, 2000 00:04
Subject:
Re: RFC for $ME class variable (was Re: RFC 124 (v1) Sort order forany hash)
Message ID:
aoh9qskfca2d7h9s1nm7mvobcsb12ttpj5@4ax.com
On Wed, 23 Aug 2000 18:02:21 -0700, Nathan Wiger wrote:

>I hate it, it's miserable. Too much hidden trickery and special cases.

Quite the countrary, I should think. Have you seen the subs
self_or_default and self_or_CGI in the source of CGI.pm? These serve to
check if a sub is called as a function or as a method. A dirty hack if
you ask me, and buggy, because if you call it as a function with a
certain string as a first argument, it will erroniously think it was a
class method.

>We have ref(), want(), and other calls to find out context, why not
>self() to backtrace package context?

	my $self = self() && shift;

Now that is ugly.

Or, do you mean:

	my $class = ref self() || self();

How much overhead would this have over $ME? What advantages would it
give?

-- 
	Bart.



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