git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org, Diane Gasselin <diane.gasselin@ensimag.imag.fr>
Subject: Re: [PATCH 1/5] Turn unpack_trees_options.msgs into an array + enum
Date: Mon, 09 Aug 2010 12:47:41 -0700	[thread overview]
Message-ID: <7vwrrz4lgi.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1281363602-27856-2-git-send-email-Matthieu.Moy@imag.fr> (Matthieu Moy's message of "Mon\,  9 Aug 2010 16\:19\:58 +0200")

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

> The list of error messages was introduced as a structure, but an array
> indexed over an enum is more flexible, since it allows one to store a
> type of error message (index in the array) in a variable.

Hmm, the only example of the advantage "enum used as array index" offers
that I can think of off the top of my head is that you can more easily
iterate over it.

> This change needs to rename would_lose_untracked ->
> would_lose_untracked_file to avoid a clash with the function
> would_lose_untracked in merge-recursive.c.

Yes, that shows one upside of "field names in a structure" has over
"enum used as array index".  We get a unique namespace.

If you are to change them to enum, I would actually suggest renaming them
a bit more to make them stand out.  Perhaps spell them all in caps,
perhaps have them share the same short prefix (UTEM_ - unpack trees error
messages), etc.

Having said all that, I am not against the main idea of this patch.

  reply	other threads:[~2010-08-09 19:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 14:19 [PATCH 0/5] Better error messages for checkout and merge Matthieu Moy
2010-08-09 14:19 ` [PATCH 1/5] Turn unpack_trees_options.msgs into an array + enum Matthieu Moy
2010-08-09 19:47   ` Junio C Hamano [this message]
2010-08-09 20:49     ` Matthieu Moy
2010-08-11  8:38       ` [PATCH 1/5 v2] " Matthieu Moy
2010-08-11  8:38       ` [PATCH 2/5 v2] merge-recursive: porcelain messages for checkout Matthieu Moy
2010-08-11  8:38       ` [PATCH 3/5 v2] merge-recursive: distinguish "removed" and "overwritten" messages Matthieu Moy
2010-08-11  8:38       ` [PATCH 4/5 v2] unpack_trees: group error messages by type Matthieu Moy
2010-08-11  8:38       ` [PATCH 5/5 v2] t7609: test merge and checkout error messages Matthieu Moy
2010-08-09 14:19 ` [PATCH 2/5] merge-recursive: porcelain messages for checkout Matthieu Moy
2010-08-09 19:58   ` Junio C Hamano
2010-08-09 20:52     ` Matthieu Moy
2010-08-09 21:15       ` Ævar Arnfjörð Bjarmason
2010-08-09 14:20 ` [PATCH 3/5] merge-recursive: distinguish "removed" and "overwritten" messages Matthieu Moy
2010-08-09 14:20 ` [PATCH 4/5] unpack_trees: group error messages by type Matthieu Moy
2010-08-09 14:20 ` [PATCH 5/5] t7609: test merge and checkout error messages Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vwrrz4lgi.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@imag.fr \
    --cc=diane.gasselin@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).