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

Re: typeset -U broken in 3.1.2?



Bernd Eggink wrote:
> Any comments (or, preferably, patches)?

The typeset code needs rewriting completely.  The interaction between
local variables and other typeset options is generally very poor.  One
other difficulty with the code is if you use typeset to change the behaviour
of a variable:  maintaining consistency between the two values can be
a big job (changing from an integer to a string is one example which is
currently handled, but there are all sorts of others).

Adding typeset -A isn't a bad idea either; it might provide an obvious
way of tying arrays and colon-separated variables together, i.e.
typeset -A arrayname -? colonname[=colon:value:with:colons] \
    [ array value in words ]
(I don't know what the ? should be; obviously you wouldn't set both the
colon version and array version at once) which would make the typeset -A
part on its own a natural counterpart to set -A, but would make the array
local if necessary (except maybe if you give -? ! That's another
problem of consistency to sort out: sometimes you don't want a
typeset made local, and some times it should depend on the name by
which it's called, e.g. export and typeset -x should be different).

But that justs makes the code even more complicated... I've always been
put off from this because you really need to start from scratch, and in
that case there's just so much to get right which in the current code has
partially agglomerated [I just checked that in WWWebster] over the centuries.

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +39 50 911239
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy



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