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

Re: Inconsistency of GLOB_ASSIGN



On Thu, 27 Nov 2014 15:00:36 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 27,  1:38pm, Bart Schaefer wrote:
> }
> } On Nov 27,  8:43pm, Peter Stephenson wrote:
> } }
> } } It would be neater always to do an array assignment, in fact, but
> } } the traditional behaviour is that if there was only one result the
> } } assignment is scalar
> } 
> } That's too bad, because making it always be an array assignment is a
> } lot simpler than figuring out whether the glob expanded to something.
> 
> So in actuality, not too much different.  Below are two patches, pick
> one ... both need the haswilds() test to preserve the behavior of
> assigning a non-glob-string-that-looks-like-math to an integer/float.

Given there not much difference, it would probably be better to stick
with the one that does scalar assignment in the case of a single entry.
I've no idea if anyone is still using GLOB_ASSIGN, but they're not
likely to be complaining about efficiency, and if they always want an
array assignment there's an easy way of getting that.

pws



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