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

Re: Bug with associative arrays(?)



Sven Wischnowsky wrote:
>   % typeset -A foo
>   % foo[a]=1
>   % foo[b]=2
>   % echo $foo
>   1 2
>   % foo=bar
>   % echo $foo
>   1 2                   # Oops?

That's the patch of Bart's that keeps getting missed out of my
versions.  It should now look something like this:

--- ../patched/zsh-3.1.5-pws-5/Src/params.c	Wed Jan 13 00:20:25 1999
+++ ./Src/params.c	Sun Jan 24 10:25:10 1999
@@ -1500,7 +1500,7 @@
     } else {
 	if (!(v = getvalue(&s, 1)))
 	    createparam(t, PM_SCALAR);
-	else if (PM_TYPE(v->pm->flags) == PM_ARRAY &&
+	else if ((PM_TYPE(v->pm->flags) & (PM_ARRAY|PM_HASHED)) &&
 		 !(v->pm->flags & (PM_SPECIAL|PM_TIED)) && unset(KSHARRAYS)) {
 	    unsetparam(t);
 	    createparam(t, PM_SCALAR);

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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