zsh-workers
 help / color / mirror / code / Atom feed
From: <hzoli@VNET.IBM.COM> (Zoltan T. Hidvegi)
To: borsenkow.msk@sni.de
Cc: zsh-workers@math.gatech.edu (Zsh workers list)
Subject: Re: RC_EXPAND_PARAM final patch
Date: Mon, 4 Aug 1997 13:21:09 -0400 (EDT)	[thread overview]
Message-ID: <9708041721.AA19076@belgium.fishkill.ibm.com> (raw)
In-Reply-To: <Pine.SV4.3.95.970804175029.1545D-100000@itsrm1> from Andrej Borsenkow at "Aug 4, 97 06:28:41 pm"

Andrej Borsenkow wrote:
> Totally agreed. If I get it right, the patch does following:
>   make substitutions (converting $^a into {a[1],a[2],...}
>   word-split the result (it can result in lists in {...} being extended
>     if SH_WORD_SPLIT is set)
>   make brace expansion in each word (with implicit word splitting)

Yes.  The current mechanism is not exactly like this, but I'm goint to
change it and this is exactly I'm going to do.  Replace $^x with a brace
expansion list, and expand it later in together with other braces.
Currently there are several problems:

belgium ~ % echo {a,b}{x,y}
ax ay bx by

That fine.

belgium ~ % x=(x y)
belgium ~ % echo {a,b}$^x
ax bx ay by

Do you see the difference?  This is going to change.  The other problem:

belgium ~ % echo {$x,z}a
{x y,z}a

It is probably not what you would expect, although ksh behaves this way.
I'm goint to change it so that the result will be 3 words:

x ya za

But this would mean an other change: ${x}{a,b} will expand to 4 words,

x ya x yb

instead of the current x ya yb.  The current behaviour is the way ksh
behaves, and the planned new one is similar to bash (you can use $* and $@
to study the behaviour of arrays in bash and ksh).

> > Here a${(e)^foo}b${(e)foo} is substituted to two identical
> > a$[i++]b${(e)foo} arguments, and substitution for these arguments is
> > started from the beginning.
>
> It is the most surprising thing I ever seen in ZSH!!! _NO_ word in manuals
> ever suggested such interpretation. I was always shure that
> ${(e)a} just gets recursivly expanded, which is what I call consistent and

The (e) stuff is completely broken, this will be fixed and it'll work like
you'd expect.

Zoltan


  parent reply	other threads:[~1997-08-04 17:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-08-02  7:27 Zoltan Hidvegi
1997-08-02 19:28 ` Bart Schaefer
1997-08-04 14:28 ` Andrej Borsenkow
1997-08-04 16:02   ` Peter Stephenson
1997-08-04 17:21   ` Zoltan T. Hidvegi [this message]
1997-08-04 18:39     ` Bart Schaefer
1997-08-04 18:51       ` Zoltan T. Hidvegi
1997-08-04 19:10         ` Bart Schaefer
1997-08-06 12:27     ` Andrej Borsenkow
1997-08-07  3:53       ` Zoltan T. Hidvegi

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=9708041721.AA19076@belgium.fishkill.ibm.com \
    --to=hzoli@vnet.ibm.com \
    --cc=borsenkow.msk@sni.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).