zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Array expansion interacts with brace expansion in the wrong order
Date: Sat, 15 Jul 2017 18:19:50 +0100	[thread overview]
Message-ID: <20170715181950.3e3887f6@ntlworld.com> (raw)
In-Reply-To: <20170714104555.0882ffe3@pwslap01u.europe.root.pri>

On Fri, 14 Jul 2017 10:45:55 +0100
Peter Stephenson <p.stephenson@samsung.com> wrote:
> This might be worth saying explicitly --- though things like this are
> implicit throughout zsh's expansion rules.

I wonder if it's also worth expanding the following?  Having reread it
in the light of Anders' query I realised "in one step" might be a bit
misleading.  Other suggestions welcome.

I'm not, to be honest, quite sure what "in one step" really meant.
I think it meant the each command line argument was changed completely
before moving onto the next.  But even if it did, that's not
*quite* right if you consider that you might generate extra arguments
from an earlier step which then need processing themselves in left
to right order.  All in all, I think obscuring the fact that the
expansions happen one after the other is unhelpful, however we tackle
it.

pws

diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index d161b0b..5b26f36 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -21,9 +21,12 @@ xitem(em(Parameter Expansion))
 xitem(em(Command Substitution))
 xitem(em(Arithmetic Expansion))
 item(em(Brace Expansion))(
-These five are performed in one step in left-to-right fashion.  After
-these expansions, all unquoted occurrences of the characters `tt(\)',
-`tt(')' and `tt(")' are removed.
+These five are performed in left-to-right fashion.  On each argument,
+any of the five steps that are needed are performed one after the other.
+Hence, for example, all the parts of parameter expansion are completed
+before command substitution is started.  After these expansions, all
+unquoted occurrences of the characters `tt(\)',`tt(')' and `tt(")' are
+removed.
 )
 item(em(Filename Expansion))(
 If the tt(SH_FILE_EXPANSION) option is set, the order of expansion is


      reply	other threads:[~2017-07-15 17:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13 22:45 Anders Kaseorg
2017-07-13 23:48 ` Bart Schaefer
2017-07-14  1:42   ` Anders Kaseorg
2017-07-14  8:48     ` Peter Stephenson
2017-07-14  9:45       ` Peter Stephenson
2017-07-15 17:19         ` Peter Stephenson [this message]

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=20170715181950.3e3887f6@ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).