git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] CodingGuidelines: remove suggestion to write commands in Perl/SH

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 17, 2021, 22:01 UTC
Message-ID
<xmqqmttwbmfm.fsf@gitster.g>
In-Reply-To
<patch-1.1-83266f30b67-20210417T084346Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> Remove a suggestion to write new commands in Perl or Shell to
> experiment. This advice was added in 6d0618a820a (Add
> Documentation/CodingGuidelines, 2007-11-08).

I think this needs to be rephrased to clarify that it is mainly to allow easier prototyping.

> Since then the consensus changed to having no new such commands unless
> necessary, and existing ones have been actively migrated to C.

Well, "unless necessary" is quite an interesting word here. There are trade-offs, and some things are not worth spending cycles to write in C than leaving quick hackability for developers.

Also existing ones getting migrated to C does nothing to support the implicit claim the above sentence makes, which is "writing the first version in C is recommended".

    If you are planning a new command, it may be easier to prototype
    by implementing it as a script, until you and others on the list
    can figure out what the semantics and end-user experience should
    be, instead of starting the initial version in C code.  Many Git
    commands started out as scripts and then later rewritten in C.

More importantly, we probably should stress that we've been very bad at maintaining plumbing to allow such quick experimentation. We should encourage (or even require) developers to make the feature they directly hacked into the Porcelain command available also to the plumbing layer, so that those who script with plumbing commands can also use it.

Show 8 quoted lines
> - - If you are planning a new command, consider writing it in shell
> -   or perl first, so that changes in semantics can be easily
> -   changed and discussed.  Many Git commands started out like
> -   that, and a few are still scripts.
> -
>   - Avoid introducing a new dependency into Git. This means you
>     usually should stay away from scripting languages not already
>     used in the Git core command set (unless your command is clearly
Previous: Ævar Arnfjörð Bjarmason
Message 9 of 9 in “CodingGuidelines: remove suggestion to write commands in Perl/SH”
  1. CodingGuidelines: remove suggestion to write commands in Perl/SHÆvar Arnfjörð Bjarmason, Apr 17, 2021
  2. Torsten BögershausenApr 17, 2021
  3. Bagas SanjayaApr 17, 2021
  4. Ævar Arnfjörð BjarmasonApr 17, 2021
  5. brian m. carlsonApr 17, 2021
  6. Ævar Arnfjörð BjarmasonApr 17, 2021
  7. brian m. carlsonApr 17, 2021
  8. CodingGuidelines: remove suggestion to write commands in Perl/SHÆvar Arnfjörð Bjarmason, Apr 17, 2021
  9. Junio C HamanoApr 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.