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

Re: RC_EXPAND_PARAM bug



On Wed, 30 Jul 1997, Andrew Main wrote:

> Zoltan Hidvegi wrote:
> >What would be the preferred evaluation of ${^a}1${^^x}?
> 
> Who cares?  Anyone mixing plan9 and non-plan9 array expansions is asking
> for trouble.  Perhaps the documentation should warn against it.
> 

After looking at rc, I agree. Actually, the implementation in ZSH is so
different, that the name RC_EXPAND_PARAM is just misleading.

In rc, there are two legal cases:
 1. concatenation of scalar (or rather list of length 1, as rc doesn't
    have scalars at all); it corresponds to RC_EXPAND_PARAM in ZSH:

    ; a=(a)
    ; x=(x y)
    ; echo $a$x
    ax ay
 2. concatenation of two lists of _equal_ size; it is _pairwise_ 
    and not cartesian product as in ZSH:

    ; a=(a b)
    ; x=(x y)
    ; echo $a$x
    ax by
 Anything else is error:
 
    ; a=(a b)
    ; x=(x y z)
    ; echo $a$x
    bad concatenation

As far as ZSH goes, I am not shure, if any reasonable way to mix arrays
with and without RC_EXPAND_PARAM in one line (word to be shure) exists.
Any way you select will give you very strange results sometimes. Probably,
it is enough, if RC_EXPAND_PARAM works with scalars, and FAQ should
mention, that anything else should better be avoided. The important thing
is to document how selected method really works and most intuitive to me
looks like disallow such mix at all ;)

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@xxxxxx
-------------------------------------------------------------------------







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