From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10100 invoked by alias); 27 Nov 2014 20:44:00 -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: 33808 Received: (qmail 27726 invoked from network); 27 Nov 2014 20:43:56 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [86.6.25.230] X-Spam: 0 X-Authority: v=2.1 cv=RdIeCjdv c=1 sm=1 tr=0 a=c0CwWhpM9oUd/BnC3z6Gzg==:117 a=c0CwWhpM9oUd/BnC3z6Gzg==:17 a=NLZqzBF-AAAA:8 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=vflUUWQ4c0zuYTq66iYA:9 a=CjuIK1q_8ugA:10 Date: Thu, 27 Nov 2014 20:43:49 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Inconsistency of GLOB_ASSIGN Message-ID: <20141127204349.036d3807@pws-pc.ntlworld.com> In-Reply-To: <141126215725.ZM13054@torch.brasslantern.com> References: <141126215725.ZM13054@torch.brasslantern.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 26 Nov 2014 21:57:25 -0800 Bart Schaefer wrote: > Yes, I know the reason is that "Config" got expanded first and then taken > as a variable name in arithmetic evaluation, therefore defaulting to the > value 0 which was assigned to x. Ick. > Still, the following seems wrong to me: > > torch% integer x > torch% typeset -p x > typeset -i x=0 > torch% x=*.h > zsh: bad floating point constant Yes, I think that if there are expansions using GLOB_ASSIGN --- for which I think the test that the result is different from the original is good enough --- we ought to treat it as either a scalar or an array assignment. The mixture is stupid. 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, and GLOB_ASSIGN is really there only for tradition. Arguably we should look at the type of the destination and if it's numeric not do a glob at all. I'd be happy with that, since: integer x x=3*3 probably doesn't mean "look for files beginning and ending in 3", but maybe it's making the whole thing even more complicated. I will try to think of a prize to give anyone who can make any language other than zsh report a floating point error when assigning an array to an integer. pws