Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:00:34

Jeff King [off-list ref] writes:
All bool config values allow "tRuE".
I was expecting somebody will bring it up, but think about it.  Bool
is a very special case.  Even among CS folks, depending on your
background, true may be True may be TRUE may be 1.

Conflating it with some random enum does not make a good argument.
Ones that take "auto" often use
strcasecmp (e.g., diff.*.binary). "blame.date" and "help.format" choose
from a fixed set of tokens, but use strcmp.
I would say that the latter is the right thing to do.
In general I do not see any reason _not_ to use strcasecmp for config
values that are matching a fixed set. It's friendlier to the user,...
Actually, I think it ends up being hostile to the users to accept
random cases without a good reason.  If you see two trailer elements
whose where are specified as "after" and "AFTER" in somebody's
configuration file, wouldn't that give a wrong impression that a new
line with the latter somehow has a stronger desire to come later
than the former?

If you consistently take only the fixed strings, you do not have to
worry about many people writing the same things in different ways,
confusing each other.

I would however fully agree with you that using strcasecmp() would
be the cleanest when reading and maintaining the code **IF** we want
to accept values in random case, but I do not agree that accepting
random cases is a good thing, so...

Re: [PATCH v8 03/12] Move lower case functions into wrapper.c

From: Jeff King <hidden>
Date: 2016-06-15 23:00:34

On Thu, Mar 27, 2014 at 03:47:01PM -0700, Junio C Hamano wrote:
Actually, I think it ends up being hostile to the users to accept
random cases without a good reason.  If you see two trailer elements
whose where are specified as "after" and "AFTER" in somebody's
configuration file, wouldn't that give a wrong impression that a new
line with the latter somehow has a stronger desire to come later
than the former?

If you consistently take only the fixed strings, you do not have to
worry about many people writing the same things in different ways,
confusing each other.
I do not agree with this line of reasoning at all. After all, do we have
confusion about the case differences between:

  [COLOR]
  diff = true

  [color]
  UI = false

But I also do not overly care. Literally zero people have complained
that "[log]date = RFC822" is not accepted, so it is probably not a big
deal either way.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help