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

Re: sorting/uniq-ing an array?

On Aug 10,  5:32pm, Zefram wrote:
} Subject: Re: sorting/uniq-ing an array?
} Bart Schaefer wrote:
} >Is there any difference (internally) between a plain array variable and
} >a colon-array, other than the set/get functions?
} Yes.  Colon-separated `arrays' are actually scalars.

Ah, yes, of course.  What I'm asking is, other than changing the cfn.gets
and cfn.sets members of the param struct to point at colonarrgetfn and
colonarrsetfn, is there any other magic involved in managing colon-arrays?

On Aug 10,  8:25pm, Andrej Borsenkow wrote:
} Subject: Re: sorting/uniq-ing an array?
} But the main problem is user interface. Standard variables are lower
} case for arrays/upper case for scalars.

Standard linked pairs of arrays and colon-arrays behave that way, yes.
I'm not (yet) suggesting adding that sort of linkage.  I'm interested
only in being able to declare a colon-array variable.  For example, I
can't think of any reason to create ld_library_path as an array.

}   typeset -C <lower case name> => implicitly creates upper case scalar
} version

I think this is the wrong approach.  I think creating the colon-array
scalar and linking it to an array should be two separate steps (or at
least two separate typeset flags).  I don't think zsh should be in the
business of enforcing upper/lower case; in fact, I don't even think it
should even be a requirement that the two variables have similar names!

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

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