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

Re: sorting/uniq-ing an array?

Bart Schaefer wrote:
> On Aug 10, 12:34pm, Bruce Stephens wrote:
> } Subject: Re: sorting/uniq-ing an array?
> }
> } "typeset -U" works for arrays, and so works for path.  Unfortunately,
> } it doesn't work with (for example) LD_LIBRARY_PATH, which is a
> } colon-separated list.  Annoying: this really needs configurableness.
> Is there any difference (internally) between a plain array variable and
> a colon-array, other than the set/get functions?  If not, it should be
> pretty trivial to make colon-arrays a typeset-able parameter type.

It is the main difference; there are some subteltis, as far as I

But the main problem is user interface. Standard variables are lower
case for arrays/upper case for scalars. What should really be done
(assuming typeset -C stays for creating colon-array variable):

  typeset -C <lower case name> => implicitly creates upper case scalar
    (or the variant of it for scalar => array)
    What, if the name is not all upper/lower case?
    What, if variable to be created exists? Or exists and is empty?

  typeset -C <scalar> <array>  => allowing arbitrary binding
    the same question with existing/empty variables

What to do, if one of such variables is explicitly unset? (Which one is
"master":) Going from implementation, scalar variable doesn't actually
exists and is created "on the fly", but in real life it is exactly
scalar which is used as base value. Should the second disappear as well?

Andrej Borsenkow 		Fax:   +7 (095) 796 99 20
SNI ITS Moscow			Tel:   +7 (095) 796 99 24

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

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