Re: RFC 152 (v1) Replace $self in @_ with self() builtin (not $ME)

[email protected] (Bart Lateur)
Newsgroups perl.perl6.language.objects
Organization MediaMind
Message-ID <[email protected]>
On Thu, 24 Aug 2000 13:27:01 -0700, Nathan Wiger wrote:

>It's a pain if you want to support both function-oriented and
>object-oriented calling forms, as CGI.pm does. For example, you can use
>both of these:
>
>   print header;
>   print $r->header;
>
>with CGI.pm. Now you need a self_of_default special method, since
>sometimes $_[0] has a class ref and sometimes it has the first method
>argument.

Don' forget to mention that if the sub can also be used as a class
method, the is NO WAY to distinguish between

	CGI->header
and
	header("CGI")

Hence, with some values for the functional argument, the detection
mechanism is unreliable.

Either $ME or self() (which, BTW, is more related to caller() than to
ref()) is 100% reliable.

-- 
	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.