Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: RC_EXPAND_PARAM final patch



Bart Schaefer wrote:
> On Aug 4,  1:21pm,  (Zoltan T. Hidvegi) wrote:
> } Subject: Re: RC_EXPAND_PARAM final patch
> }
> } belgium ~ % echo {$x,z}a
> } {x y,z}a
> }
> } It is probably not what you would expect, although ksh behaves this way.
>
> Actually, this is exactly what I'd expect.  The $x is inside the { },
> so the entire value of $x should be treated as part of the brace
> expansion.

I do not understand you.  Yes, I agree, that the entire value of $x should
be treated as part of the brace expansion, but this is not what happens
right now, as the result is two words, `{x' and `y,z}a', with braces
appearing in the result and not used for brace expansion.  I thought that
this is not what you expect.  What I would expect is 3 word result,

x ya za

> What, then, is the result of `echo {w,$x,z}a' ?  I can't imagine that
> anyone would expect that to be the same as `{w,x} {y,z}a'.  Who told
> zsh to put the extra } { in there?

Noone.  The result will be 4 words,

wa x ya za

This is different from the result of {w,x} {y,z}a which is w x ya za.  Or
do you have some more reasonable alternative?

> } But this would mean an other change: ${x}{a,b} will expand to 4 words,
> }
> } x ya x yb
>
> This is fine, assuming that {p,q}${x}{a,b} expands to 8 words
>
> px ya qx ya px yb qx yb

Almost, but the order is different:

px ya px yb qx ya qx yb

Zoltan



Messages sorted by: Reverse Date, Date, Thread, Author