zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Nofork ${{var}...} edge cases
Date: Thu, 28 Mar 2024 01:29:09 +0100	[thread overview]
Message-ID: <CAHYJk3QRHHO8BUPEs1W5dpTukGJbePAw14fq_RgzgibXf0BcRQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YHZspc2JVBxkkYO69Cr9x__s-m4UQqRUfOetZYssUqnw@mail.gmail.com>

On Wed, Mar 27, 2024 at 7:58 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> Just seeking opinions:
>
> Should ${{} true} (empty variable name) result in "bad substitution"?
> Otherwise it's all side-effects, because nothing will be substituted.
> The prior ${|| true} form was a parse error.
>
> Should ${{var}} be a "bad substitution", or print a warning about an
> empty command?  Otherwise it just substitutes $var.

Is a space no longer required after } (formerly ||) to trigger the
command substitution? I personally would like to get an error in this
case because missing a $ in nested substitutions is a fairly common
typo. Eg I meant ${${var}}. And if no space is required, does that
mean if you typo ${${foo}:-blabla} into ${{foo}:-blabla}, :-blabla is
suddenly executed as a command? If the space is actually still
required then I don't have any real complaints. I think it was clearer
at a glance that ${|foo| bing} was doing something different as
opposed to ${{foo} bing} but i suppose i don't feel that strongly
about it.

-- 
Mikael Magnusson


  parent reply	other threads:[~2024-03-28  0:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 18:57 Bart Schaefer
2024-03-27 22:22 ` Oliver Kiddle
2024-03-28  1:00   ` Bart Schaefer
2024-03-28  1:21     ` Bart Schaefer
2024-03-28  1:32       ` Bart Schaefer
2024-03-28  0:29 ` Mikael Magnusson [this message]
2024-03-28  1:12   ` Bart Schaefer

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=CAHYJk3QRHHO8BUPEs1W5dpTukGJbePAw14fq_RgzgibXf0BcRQ@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).