Subject: Re: [PATCH] strbuf: use designated initializers in STRBUF_INIT

From: Junio C Hamano <[email-masked]>
Date: Wed, 12 Jul 2017 14:08:41 -0700

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

> On Tue, Jul 11 2017, Junio C. Hamano jotted:
>
>> Just so that people do not misunderstand, it is not our goal to
>> declare that now you need a fully C99 compiler to build Git.
>> ...
>
> I think in the context of this desire Johannes Sixt's "Actually, I'm
> serious [about let's compile with c++]"[1] should be given some more
> consideration.
> ...
> Most of his patch is just avoiding C++ keywords, e.g. new -> wen, try ->
> try_, this -> this_, namespace -> name_space, template -> templ
> etc. It's going to be relatively easy to avoid a few keywords as
> variable names, especially if we set up CI for it via Travis.

I am not interested at all in building the binary I personally use
with any C++ compiler, but I do not mind too much if people made it
easier for other people to do so, but only if the did it the right
way.

I do like the fact that we call two things we are comparing with a
pair of matching words, 'old' and 'new'.  When two variables or
fields have certain relationship, they should be named with words
that have constrasting meaning that explains what they are.

I would very much mind if a "let's make it buildable with C++"
effort made the code compare 'old' and 'wen'.  C++ is not that
interesting to sacrifice the readability of the code.  Don't invent
non-words like wen; don't truncate a word like 'template' in the
middle to 'templ' to make it unreadable and invite inconsistencies
(e.g. "was it templ, templa, or something else?").

If a "let's make it buildable with C++" effort needs to avoid 'new',
replace *both* 'old' and 'new' to a matching pair of words (perhaps
'pre' and 'post'?  but it is making it worse by choosing a pair with
different length.  'one' vs 'two' would be OK if there is no strong
connotation that the 'old' side is always truly older in the
function in question).

I would not mind the result of such an update that much.  We already
do use different pair of words in places that we could have used
<old, new> after all.

Having to review too many updates like that in a single sitting
would be annoying, though.

The same thing for where we use 'this'; if the existing code is
contrasting 'this' with 'that', and if your C++ effort wants to
replace 'this', you MUST replace 'that' as well so that we would
still be contrasting a pair of variables appropriately named.