develooper Front page | perl.perl6.language.objects | Postings from August 2000

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

From:
merlyn
Date:
August 24, 2000 14:16
Subject:
Re: RFC 152 (v1) Replace $self in @_ with self() builtin (not $ME)
Message ID:
m1em3ewe9x.fsf@halfdome.holdit.com
>>>>> "Nathan" == Nathan Wiger <nate@west.sun.com> writes:

Nathan> The key difference is this: $_[0] always contains the first method
Nathan> argument, regardless of whether you're in an object-oriented or
Nathan> function-oriented context. So, if you need to support both (like CGI.pm
Nathan> and my own File::Remote must), you don't have to write some special
Nathan> method that detects whether $_[0] is a valid class ref (see
Nathan> self_or_default in CGI.pm).

yes, I like this.

Nathan> This fixes a lot of stuff. Plus, "self" is one char shorter than
Nathan> "shift"! ;-)

Heh!  All that typing I would have saved over the years, would
probably be equal to the number of characters I've typed here
debating this point. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



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