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

Re: [PATCH][GIT.PM 2/3] Getting rid of throwing Error::Simple objects in favour of simple Perl scalars which can be caught in eval{} blocks

From
ASAndrew Sayers <andrew-git@pileofstuff.org>
Date
May 23, 2012, 19:36 UTC
Message-ID
<4FBD3C2D.3010107@pileofstuff.org>
In-Reply-To
<CAB3zAY3nVDiBH6kJKK9YTXKsaFZZnUz7AAFh5z+J0VhXHjYiMQ@mail.gmail.com>
On 23/05/12 12:02, Subho Banerjee wrote:
Show 13 quoted lines
> Hi,
> The semantic
>>        <fail> unless <noun>
> works well when the <fail> part of the code is a singular statement.
> But it is of ungainly when there are a couple of statements to be
> executed as a block. In this case, I believe that a the conjunctive
> ,,or''/,,and'' statement makes more sense. In the sense -
>                  <verb1> or <die_gracefully1> and <die_gracefully2>
> I believe this is easier to read compared to -
>                  <die_gracefully1> and <die_gracefully2> unless <noun>
> especially if you have a larger block of commands to execute in case
> of the failure. I believe the easiest to read would be a classical C
> styled if() block, but that would make the code more "verbose" :-)

To be honest, I drop straight back to C-style if() statements as soon as I have to start thinking consciously about precedence rules (where by "thinking" I mean "creating bugs then failing to see them under my nose"). I also don't think anyone would object if you wanted to stick with classic if() statements everywhere - colloquialisms are supported, not required :)

So long as you're aware this is an exception to the rule about matching the style of surrounding code, I'm personally quite relaxed about fixing these specific instances. If nobody else has any opinions, maybe hold off and see how much change you're planning to make elsewhere? No sense getting too attached to code you might have to throw away.

	- Andrew
Previous: Subho BanerjeeNext: Subho Sankar Banerjee
Message 21 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.