git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git.pm

From
Ddemerphq <demerphq@gmail.com>
Date
May 10, 2012, 17:38 UTC
Message-ID
<CANgJU+WR9zWbwrHK-PT0jKKNQ6ZXv=9oGxOuQh6iLZaORohGBQ@mail.gmail.com>
In-Reply-To
<7vr4usnh2q.fsf@alter.siamese.dyndns.org>
On 10 May 2012 18:20, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> demerphq <demerphq@gmail.com> 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.
Show 7 quoted lines
> 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/"
Previous: Junio C HamanoNext: Andrew Sayers
Message 12 of 24 in “Git.pm”
  1. Subho BanerjeeApr 26, 2012
  2. Randal L. SchwartzApr 26, 2012
  3. Tim HeniganApr 26, 2012
  4. Subho BanerjeeApr 26, 2012
  5. Jonathan NiederApr 26, 2012
  6. Subho BanerjeeMay 10, 2012
  7. Jonathan NiederMay 10, 2012
  8. demerphqMay 10, 2012
  9. Subho BanerjeeMay 10, 2012
  10. demerphqMay 10, 2012
  11. Junio C HamanoMay 10, 2012
  12. demerphqMay 10, 2012
  13. Andrew SayersMay 10, 2012
  14. demerphqMay 11, 2012
  15. Randal L. SchwartzMay 11, 2012
  16. Junio C HamanoMay 11, 2012
  17. [GIT.PM 1/3] Ignore files produced from exuberant-ctagsSubho Sankar Banerjee, May 19, 2012
  18. [GIT.PM 2/3] Getting rid of throwing Error::Simple objects in favour of simple Perl scalars which can be caught in eval{} blocksSubho Sankar Banerjee, May 19, 2012
  19. Andrew SayersMay 19, 2012
  20. Subho BanerjeeMay 23, 2012
  21. Andrew SayersMay 23, 2012
  22. [GIT.PM 3/3] Perl code uses eval{}/die instead of Error::Simple and Git::Error::CommandSubho Sankar Banerjee, May 19, 2012
  23. Junio C HamanoApr 26, 2012
  24. Sam VilainApr 26, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.