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

Re: New typeset is a bit too verbose, and skips some assignments



On Jun 25,  5:40pm, Peter Stephenson wrote:
} Subject: Re: New typeset is a bit too verbose, and skips some assignments
}
} On Thu, 25 Jun 2015 09:21:31 -0700
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > The value of x should not have been displayed by the second typeset
} 
} That's related to my previous fix --- x=() causes x to be marked as an
} array but with no value, not just an empty list.

Thanks for the patch, but it still doesn't address my second point:

> the initial empty assignment doesn't have any effect:
> 
> torch% typeset y   
> torch% typeset y=() y[2]=a y[4]=b
> torch% typeset y=() y[1]=x y[3]=z
> y=('' a '' b)
> torch% typeset -p y
> y=(x a z b)
> torch% 
> 
> I expected y=(x '' z '').

This works for scalars, i.e.

torch% typeset x=abcd x[1]=1 x[3]=3
torch% typeset -p x
typeset x=1b3d
torch% typeset x='' x[2]=2 x[4]=4
torch% typeset -p x              
typeset x=24
torch% 

Note that I did NOT get x=1234 out of that last.



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