A. Pagaltzis wrote:
> * Uri Guttman <uri@stemsystems.com> [2007-12-09 19:25]:
>> i don't like using shift for args if i can help it.
>
> Personally I *always* use `shift` for the invocant, but
> assignment from `@_` for all other parameters in all but a few
> rare circumstances. So methods in my code always read something
> like this:
>
> sub frobnitz {
> my $self = shift;
> my ( $foo, $bar, $baz ) = @_;
> # ...
> }
>
> It’s a nod to the fact that the invocant is not really in the
> same class (no pun intended) as the other parameters. Since
> `$self` is thus removed from `@_`, and is the *only* thing
> removed from it, that also makes it natural to write delegative
> code:
>
> # ...
> $self->get_veeblefitzer()->frobnitz( @_ );
> # ...
+1
--
...they shared one last kiss that left a bitter yet sweet taste in her
mouth--kind of like throwing up after eating a junior mint.
-- Dishonorable Mention, 2005 Bulwer-Lytton Fiction Contest
by Tami Farmer
Thread Previous
|
Thread Next