Re: [PATCH v5 1/9] Start to implement a built-in version of `git add --interactive`
From: Junio C Hamano <hidden>
Date: 2019-11-11 12:09:56
Johannes Schindelin [off-list ref] writes:
And I agree that this sidetrack is totally irrelevant for the patch under discussion. I do think, however, that the discussion of "we wanted to do it the other way, but when we tried, it did not work" is relevant, even if I shortened it to "we use a different approach than previous conversions, because that previous approach would not work".
Regardless of the language the scripted version was written in, I
think the '--helper' approach is always the poorer choice between
the two [*1*]. It limits the modular decomposition to what suits the
original language, the impedance mismatch between the original and
target language forces us to unnatural style of inter module
communication, and the unnatural interface layer, which we know has
to be discarded at the end, must be written [*2*].
So, I'd prefer to see "because this is a better way in the longer
term" over "because the --helper approach would not work".
[Footnote]
*1* In only one case I would recommend using "--helper" approach,
though. When you are not expecting the developer to be able to
come up with a better split of the program into modules than how
the scripted version is, and you want to ensure that the
developer have something to show when they faild to complete the
project after N weeks. You are a more experienced developer
than an average GSoC student, and there is no pencils-down time,
so the exception would not apply.
*2* In "git submodule" for example it was quite natural for the
module that gives a list of submodules with its traits the
program cares about to be written as a shell function that
writes the data to its standard output. And consuming modules
sit at the downstream of a pipe, accepting its output. When you
are writing these modules both in C, you wouldn't connect them
with pipe to carry the list of submodules, but a piecemeal
conversion using the "--helper" approach meant that there always
remained _some_ consumer that wants to read from the pipe, so
long after the module lister was rewritten in C, it still needed
to support a mode where it sends its output to the pipe, instead
of just passing an array of structures.