Subject: Re: [PATCH v2 5/6] trailer: rename *_DEFAULT enums to *_UNSPECIFIED

From: Junio C Hamano <[email-masked]>
Date: Mon, 11 Sep 2023 11:54:42 -0700

"Linus Arver via GitGitGadget" <[email-masked]> writes:

> From: Linus Arver <[email-masked]>
>
> Do not use *_DEFAULT as a suffix to the enums, because the word
> "default" is overloaded. The following are two examples of the ambiguity
> of the word "default":

In this case these are left unspecified to use the default; while it
is not wrong per-se to say *_DEFAULT, using *_UNSPECIFIED makes it
more obvious.

> So instead of using "*_DEFAULT", use "*_UNSPECIFIED" because this
> signals to the reader that the *_UNSPECIFIED value by itself carries no
> meaning (it's a zero value and by itself does not "default" to anything,
> necessitating the need to have some other way of getting to a useful
> value).

It gets tempting to initialize a variable to the default and arrange
the rest of the system so that the variable set to the default
triggers the default activity.  Such an obvious solution however
cannot be used when (1) being left unspecified to use the default
value and (2) explicitly set by the user to a value that happens to
be the same as the default have to behave differently.  I am not
sure if that applies to the trailers system, though.

Thanks.

PS.  Glen's old e-mail address is no longer valid and there is no
forwarding done by @google.com mailservers, it seems.  Can you tell
GGG to drop the address (optionally replace it with his new address)?