On 2012.7.26 10:18 PM, Junio C Hamano wrote:
>> +# Note: not certain why this is in use instead of die. Probably because
>> +# the exit code of die is 255? Doesn't appear to be used consistently.
>> +sub fatal (@) { print STDERR "@_\n"; exit 1 }
>
> Very true. Also I do not think the line-noise prototype buys us
> anything (other than making the code look mysterious to non Perl
> programmers); we are not emulating any Perl's builtin with this
> function, and I do not see a reason why we want to force list
> context to its arguments, either. But removal of it is not part of
> this step anyway, so I wouldn't complain.
The prototype does absolutely nothing since @ is the default prototype. But
yes, I'm doing a very rote refactoring here.
>> +sub can_compress {
>> + return $can_compress if defined $can_compress;
>> +
>> + return $can_compress = eval { require Compress::Zlib; } ? 1 : 0;
>> +}
>
> The original said "eval { require Compress::Zlib; 1; }"; presumably,
> when require does succeed, the value inside is the "1;" that has to
> be at the end of Compress::Zlib, so the difference should not matter.
Yes. In other situations where you cannot guarantee that the statement in the
eval will return true it makes sense, but here it's redundant.
--
Being faith-based doesn't trump reality.
-- Bruce Sterling
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html