Re: RFC 152 (v1) Replace $self in @_ with self() builtin (not $ME)
[email protected] (Tom Christiansen)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <9359.967138010@chthon> |
>Currently, the current object context is passed into a sub as the first
>element of @_, leading to the familiar construct:
> my $self = shift;
>However, this is a big PITA. In particular, if you support lots of
>different calling forms (like CGI.pm), you have to check whether $_[0]
>is a ref, etc, etc, etc.
It is? I don't see that this is a pain at all. It seems like
a beautiful point of homogenization. You don't force the user
to say $self; they could use $this if they wanted. Heck, they
don't need it at all.
my(undef, @args) = @_;
Or as in
shift->fn(@_)
This is one of the things that Larry, in borrowing much of Perl's
OO from Python, carefully preserved from the parent tongue. Don't
see why you would break it.
--tom