Re: RFC 152 (v1) Replace $self in @_ with self() builtin (not $ME)
[email protected] (Nathan Wiger)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Organization | Sun Microsystems |
| Message-ID | <[email protected]> |
Tom Christiansen wrote: > > 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) = @_; 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. > Or as in > > shift->fn(@_) I don't see how this RFC is super-revolutionary, personally. Your example would just become: self->fn(@_); with the added benefit that, unlike shift->fn(@_), you can call the same thing 10 times in a row and it still works: self->fn1(@_); self->fn2(@_); # can't do that with shift I also don't see how this precludes the use of $ME, $self, $this, or any other variable name: $ME = self; $self = self; $this = self; -Nate