Re: [PATCH v3 07/28] git-remote-mediawiki: Rewrite unclear line of instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Célestin Matte <celestin.matte@xxxxxxxxxx> writes:

> Le 11/06/2013 20:09, Junio C Hamano a écrit :
>> Matthieu Moy <Matthieu.Moy@xxxxxxxxxxxxxxx> writes:
>> 
>>>>       my ($namespace) = @_;
>>>> 	my $namespace = shift;
>>>>
>>>> My impression has been that both are equally common,
>>>
>>> The second is the most common in git-remote-mediawiki (but I don't have
>>> any preference nor know what is recommended elsewhere).
>> 
>> I wasn't implying I prefer the former.  I was just being curious,
>> and if the latter is more prevalent in the code _and_ Perlcritique
>> does not have any issue with it, it is perfectly fine.
>
> Perlcritic doesn't have an issue with any of both cases.

OK.  As this topic is about matching the opinion of Perlcritique, I
think it is fine either way (which was the primary thing that I
wanted to find out).

> I think the second method is clearer when there is only one argument,
> because it makes it clear that there is only one.

Hmm, from the maintenance point of view, the second one invites the
next person to extend this function like this:

	my $namespace = shift;
+       my $newargument = shift;
+	my $anotherargument = shift;

If your original were in the first style, instead you would likely to
get this:

-	my ($namespace) = @_;
+	my ($namespace, $newargument, $anotherargument) = @_;

When there is only one argument, it is clear that there is only one
argument in either style.  It is not a strong factor to pick one
style over the other.  Once you start taking more than one argument,
however, I think "it makes it clear what arguments the function
takes" would actually favor the style to split @_ into a list of
local variables.

But as I said earlier, this patch is about following Perlcritique's
advice, and because it does not have opinion on these styles, it is
outside the scope of this patch.

Thanks for checking.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]