Re: [PATCH v3] builtin/revert.c: refactor using an enum for cmd-action

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12. Jan 2024, at 19:13, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> > But your way of seeing it also makes sense to me. I think I just find
> > the "START" name jarring because we do not use that word elsewhere to
> > describe the action.
> 
> Thanks.  I forgot to say that I share the same feeling, both about
> "NONE could mean no-op" (but then seriously why would anybody sane
> want that?) and "START is not how we spell these things".  I can see
> how DEFAULT could make sense, but if somebody picked DEFAULT between
> two sensible choices NONE and DEFAULT here, especially if they claim
> that they started this enum to mimick what is done in another place,
> and after they were told that the other place they are imitating
> follows the convention of using NONE for "nothing specified, so use
> default", I would have to say that they are trying to be different
> for the sake of being different, which is not a good sign.  I'd want
> our contributors to be original where being original matters more.

I am sorry to have left this feeling in you. It was not my intention to
be original, but I just did not understand the reason for the other
name. If I wanted to be "sneaky" and wasn't truly open for a discussion
I would not have mentioned that it is different in the other file. I
don't try to be original for the sake of it, but yes indeed if I have a
hard time understanding some reasoning, in my day job it is my role to
ask these. But I think I am indeed questioning a bit too much here.
Sorry for that! You as the project lead constantly have to do the same
and I am in awe as how you handle it.

I am sorry that this discussion did get out of hand. Especially since
this patch does not even introduce a feature, but is only a refactoring
of an already perfectly fine codebase. My only intention was to align
builtin/refactor.c a bit more to builtin/rebase.c but the current state
is 100% good as is, so I think we should just drop this discussion.

> > + if (cmd != ACTION_START)
> > 
> > Likewise here I'd probably leave this as "if (cmd)".
> 
> I 100% agree with the suggestion to explicitly define something to
> be 0 when we are going to use it for its Boolean value.  So an
> alternative would be to treat all ACTION_* enum values the same, and
> not define the first one explicitly to 0.  
> 
> Especially in the context of a patch that wants to turn if/elseif
> cascades to switch, I would suspect that the latter, as switch/case
> does not special case the falsehood among other possible values of
> integer type, might be easier to maintain in the longer term.

That is indeed what v4 of the patch did that I prepared half a day ago
and just did not have the time to properly check again before I submit
it. It also tackles the other issues you mentioned, but my feeling is
that the current state is good as it is with the characters and so we
should just drop this discussion.

Sorry to have caused such a stir and that I took so much of all of your
valuable time! I for myself have learned a great deal from all of you
and your interactions, so thank you!

Michael Lohmann




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux