From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4460 invoked by alias); 28 Nov 2014 09:44:35 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33817 Received: (qmail 15202 invoked from network); 28 Nov 2014 09:44:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-7c-5478419ce792 Date: Fri, 28 Nov 2014 09:34:20 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Inconsistency of GLOB_ASSIGN Message-id: <20141128093420.4fbeab70@pwslap01u.europe.root.pri> In-reply-to: <141127150036.ZM5089@torch.brasslantern.com> References: <141126215725.ZM13054@torch.brasslantern.com> <20141127204349.036d3807@pws-pc.ntlworld.com> <141127133833.ZM6853@torch.brasslantern.com> <141127150036.ZM5089@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmluLIzCtJLcpLzFFi42I5/e/4Fd05jhUhBt+fKFgcbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujNNtv9kK9nNUzJy7n6mB8R5bFyMHh4SAicSyacJdjJxAppjE hXvrgcJcHEICSxklHm+4zgLhLGeSaF07jRWkikVAVWL6m1ssIDabgKHE1E2zGUFsEQFxibNr z4PFhQU0JSZsX8MGYvMK2Et093xmAlnGKWApMWVxJUhYSOA4o8S1peUgNr+AvsTVv5+YII6w l5h55QwjRKugxI/J98BGMgtoSWze1sQKYctLbF7zlnkCo8AsJGWzkJTNQlK2gJF5FaNoamly QXFSeq6hXnFibnFpXrpecn7uJkZIAH7Zwbj4mNUhRgEORiUe3oTHZSFCrIllxZW5hxglOJiV RHhPfS0PEeJNSaysSi3Kjy8qzUktPsTIxMEp1cDoUfqkvjNbU3Z+mWF34N1QEe6EuPkJ8569 yX0flmQ7TbfhOH9KlM+iLXarLfWyrRdPOKzt5ezGUu/0WNJpgcWCpdo79O7emG+0uaFQN8Xg oPSp213NPLd+cIvqChlFxgXPUD6SdSRizS0B7weRbNz297KfPxT9O7Phnce2dfsj9rPENpaZ GCmxFGckGmoxFxUnAgA+UJzcHgIAAA== On Thu, 27 Nov 2014 15:00:36 -0800 Bart Schaefer 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