Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 1/5] Turn unpack_trees_options.msgs into an array + enum

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:16

Matthieu Moy [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help