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

Re: Changes for dev-4



Wayne Davison wrote:
> Actually, I didn't change = because I was thinking that it would just
> turn into a scalar anyway.  However, since the assignment might be to an
> array, it could also benefit from the new array-split-preservation code.
> 
> Attached is a patch that fixes this.  Let me know if you agree that this
> is something that should make it into 4.3.1.  (I'll check-in the first
> tweak to the README file, since it fixes a typo.)

I certainly missed the fact that it doesn't fix a compatibility problem
since you can't assign to an array in the other shells that way.
Ideally we probably want it to be whatever would happen in bash or ksh,
seeing as sh doesn't have arrays, though by the looks of things it's the
same.

In ksh I get:
$ set -A foo
$ set "one word" "two words"
$ : ${foo:="$@"}
$ echo ${foo[0]}
one word two words

and in zsh I get:
% setopt shwordsplit
% set -A foo
% set "one word" "two words"
% : ${foo:="$@"}
% print ${(t)foo}
scalar

So it looks like from the compatibility point of view we're OK either
way.

I would guess that with zsh's ability to assign arrays it would be
better to keep this consistent with the other forms, as in your patch,
however.

(We should probably hold off on the other one, that moves the flag into
the link node, until 4.3.1, though it is useful simplification to have
later.)

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



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