Re: Git.pm

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

 



On 10 May 2012 18:20, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> demerphq <demerphq@xxxxxxxxx> writes:
>
>> Similar logic for Try::Tiny. Why bother with it? It is pretty close to
>> a fancy way to write eval { ...; 1 } or do { .... };  It is just one
>> more module for people to misunderstand, and then make bugs with.
>
> I personally like the approach to stick to bare "eval {}; if ($@) { ... }"
> sequence, as it is much more explicit and easier to understand what is
> happening underneath.  IOW, I like what I read in demerphq's message.

Basically that is the idiom that Try::Tiny encourages people not to
use. Unfortunately the idiom documented in the Perl docs has been
subtly wrong for pretty much ever due to a subtle bug in perl (which
took years to come to light). :-(

Anyway, anything written like this:

eval {
       whatever();
       1;
} or do {
    my $error= $@ || "Zombie Error";
    do_something_with_error($error);
};

is fine. See my other post to the list for details.

> But it could be that these many people who wrote these different
> catch/throw things did so for a reason that I am missing, and if that is
> the case, I am interested to hear what benefit we will get from using
> them.
>
> "It looks more familiar to people with (your favorite language)" could be
> it, but then I would not regret missing such a reason ;-)

A few might justify things based on the bug in Perl, but I suspect the
real motivation people have to use it is to emulate other languages
constructs.

The author of Try::Tiny might be an exception, I am reasonably
convinced he was trying to provide a service to the community, but IMO
on the balance of things the module muddies the water more than it
improves things.

cheers,
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
--
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]