All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Danh Doan <congdanhqx@gmail.com>, clime <clime7@gmail.com>,
	Git List <git@vger.kernel.org>
Subject: Re: [PATCH] CodingGuidelines: drop arithmetic expansion advice to use "$x"
Date: Tue, 05 May 2020 13:40:03 -0700	[thread overview]
Message-ID: <xmqqr1vy9kv0.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200504160709.GB12842@coredump.intra.peff.net> (Jeff King's message of "Mon, 4 May 2020 12:07:09 -0400")

Jeff King <peff@peff.net> writes:

> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index 390ceece52..a89e8dcfbc 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -95,10 +95,6 @@ For shell scripts specifically (not exhaustive):
>  
>   - We use Arithmetic Expansion $(( ... )).
>  
> - - Inside Arithmetic Expansion, spell shell variables with $ in front
> -   of them, as some shells do not grok $((x)) while accepting $(($x))
> -   just fine (e.g. dash older than 0.5.4).
> -
>   - We do not use Process Substitution <(list) or >(list).
>  
>   - Do not write control structures on a single line with semicolon.

A new entry in the "What's cooking" report has this:

    * jk/arith-expansion-coding-guidelines (2020-05-04) 1 commit
     - CodingGuidelines: drop arithmetic expansion advice to use "$x"

     The coding guideline for shell scripts instructed to refer to a
     variable with dollar-sign inside airthmetic expansion to work
     around a bug in old versions of bash, which is a thing of the past.
     Now we are not forbidden from writing $((var+1)).

Writing the last sentence made me wonder if we should go one step
further and actually encourage actively omitting the dollar-sign
from variable reference instead.

  parent reply	other threads:[~2020-05-05 20:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-02 20:31 git for-each-ref - sorting by multiple keys clime
2020-05-03  9:09 ` Jeff King
2020-05-03  9:11   ` [PATCH 1/2] ref-filter: apply --ignore-case to all sorting keys Jeff King
2020-05-03 11:44     ` Danh Doan
2020-05-04 15:13       ` Jeff King
2020-05-04 15:37         ` Junio C Hamano
2020-05-04 16:07           ` [PATCH] CodingGuidelines: drop arithmetic expansion advice to use "$x" Jeff King
2020-05-04 16:28             ` Carlo Marcelo Arenas Belón
2020-05-04 16:33               ` Jeff King
2020-05-04 19:47                 ` Junio C Hamano
2020-05-04 23:32             ` Danh Doan
2020-05-05 20:40             ` Junio C Hamano [this message]
2020-05-05 21:07               ` Jeff King
2020-05-05 21:30                 ` Junio C Hamano
2020-05-04 21:00     ` [PATCH 1/2] ref-filter: apply --ignore-case to all sorting keys Junio C Hamano
2020-05-05  0:11       ` Jeff King
2020-05-05  0:13     ` Taylor Blau
2020-05-03  9:13   ` [PATCH 2/2] ref-filter: apply fallback refname sort only after all user sorts Jeff King
2020-05-04 21:05     ` Junio C Hamano
2020-05-05  0:14       ` Taylor Blau
2020-05-03 10:16   ` git for-each-ref - sorting by multiple keys clime

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr1vy9kv0.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=clime7@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.