Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: RC_EXPAND_PARAM bug
- X-seq: zsh-workers 3384
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxx>
- To: schaefer@xxxxxxx
- Subject: Re: RC_EXPAND_PARAM bug
- Date: Tue, 29 Jul 1997 03:36:48 -0400 (EDT)
- Cc: zsh-workers@xxxxxxxxxxxxxxx (Zsh hacking and development)
- In-reply-to: <970729000902.ZM15018@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Jul 29, 97 00:09:02 am"
> On Jul 29,  2:04am, Zoltan Hidvegi wrote:
> > 
> > % echo 1${^a}1${^^x}
> > 1a1x 1ay 1b1x 1by
> > 
> > The logic is that the string after the rc-param, 1${^^x}, is expanded,
> > producing two strings, 1x y, which is combined with 1a 1b.  It is true
> > that this is incompatible with 2.6-beta16 and older, which first expanded
> > it to 1a1${^^x} 1b1${^^x} and later this was expanded to 1a1x y 1b1x y.
> > Similarily, let i=0; echo ${^a}$[i++] expanded to a$[i++] b$[i++] and
> > later to a0 b1, while in zsh-3.0.4 it expands to a0 b0.
> 
> Can you generalize this rule for us?  E.g.
> 
> % echo ${^a}$[i++]$[++j]${^x}....
> 
> where .... is some arbitary number of other substitutions?  Is it just that
> it now does everything from right to left instead of left to right?  Why?
No, it is left to right.  ${^a} is expanded first, then the remaining
part, $[i++]$[++j]${^x} is expanded separately, and the result is
combined with the expansion of ${^a}.  You can see it if you try
let i=0; echo $[i++]${^a}$[i++]
which gives
0a1 0b1
If it were right to left, it would be 1a0 1b0.
Zoltan
Messages sorted by:
Reverse Date,
Date,
Thread,
Author