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

[email protected] (Bart Lateur)
Newsgroups perl.perl6.language.objects
Organization MediaMind
Message-ID <[email protected]>
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.
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.