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

Re: zsh3.0.0 bug: $=a split

[I'm back earlier than I promised but do not expect too much from me in the
 next two days... :-) ]

Zefram wrote:
> >Now, I need the parentheses or need to declare i as an array, but
> >before i would automatically be set to an array:
> That's mentioned about two pages down Etc/NEWS, but in the context of
> globbing.  Globbing in assignments can be turned on with GLOB_ASSIGN,
> but there's no option to do field splitting to generate an array.
> You'll just have to use parentheses, which works with older zsh
> versions anyway.
> Zoltan: should GLOB_ASSIGN be extended to generate arrays based on
> field splitting too?  Or do we now want to remove this option
> entirely?

I do not like GLOB_ASSIGN and I really feel that it should be completely
removed.  Zsh-2.5.0 handled such situations much worse than 3.0.0.  If foo
was an array with zero or one elements, after a


assignment it changed to a scalar.  Otherwise it remaned an array.  After


foo was array if * expanded to more than 1 files otherwise foo become a
scalar.  That piece of code which did that also caused `ambiguous' error
message from zsh in some other situations (I could not tell now any but
that may happen every time singsubst() is called).

In an assignment,


it may seem to be logical for foo to become an array if bar is an array but
what should happen if I write foo=/$bar?  Internally the RHS is evaluated
and after that it is not possible to tell if the result came from an array
expansion or word splitting or globbing etc.  glob_assign only enables
globbing after the other expansions.  The other expansions will still
produce a single word.


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