From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24373 invoked by alias); 14 May 2011 09:03:56 -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: 29279 Received: (qmail 28714 invoked from network); 14 May 2011 09:03:43 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XWYAxJym6HDBBZqQZH0E4rvcPJVqlu/4iiHQ3kL7U8U=; b=N5VyJnn9Ri3JfgSgx5bnrmUK8cL7BzrF+vlcQm72qq2s0tdqOpXTWg0u6H9vlSnfjc L/1V5TDClwhDRzRf1seovRg8cYOuGlpv2a6V3KDWmo1ZAj/yKTmVv8hWd2gThwPkLnsJ Iz44bRnVOEJZ++oLzVwXIJoQKWkA3LUyQfTOw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Q6p5CkRzVOfLWW9f7qzfRzlxP2tEHHh2rpaoKxgd4mq31/a5Yub87aSwUWu/wKHr9l EZ8QPEdAgX/LA1bTlxHym2KEsFfQkqlma0HDdMhS34U0dj7fesF8k/ZBsmKTZMMQm0Ib HjTzRY1us/J9hPYf45u4PCM4QRxbUQ/lfItV8= MIME-Version: 1.0 In-Reply-To: <110513213633.ZM13611@torch.brasslantern.com> References: <110513213633.ZM13611@torch.brasslantern.com> Date: Sat, 14 May 2011 11:03:36 +0200 Message-ID: Subject: Re: Infinite recursions in math evaluation From: Mikael Magnusson To: Bart Schaefer Cc: zsh workers Content-Type: text/plain; charset=UTF-8 On 14 May 2011 06:36, Bart Schaefer wrote: > On May 13, 11:37pm, Mikael Magnusson wrote: > } > } [...] Aha, actually a=a; $(( a )) crashes in the same way. (On > } a machine with a presumably less optimized/buggy compile, it does > } print "zsh: math recursion limit exceeded" instead of crashing). Is it > } simply a user error? I wouldn't expect either of these expressions to > } recursively look up values of the parameter until it encountered a > } number, but this is indeed what happens: > } % a=b; b=c; c=d; d=e; e=f; f=5; echo $(( a )) > } 5 > } bash does the same... > } > } I scanned quickly through the "Arithmetic Evaluation" section and > } found nothing suggesting that this should happen. > > It's implicit in this: > > Named parameters and subscripted arrays can be referenced by name > within an arithmetic expression without using the parameter expansion > syntax. For example, > > ((val2 = val1 * 2)) > > assigns twice the value of $val1 to the parameter named val2. Well, I read that part, but > "The value of $val1" in an arithmetic context is the result of doing > arithmetic evaluation on whatever is stored in the parameter. If > that's the name of another (or even the same) parameter, then ... How did you get this from the quoted part? -- Mikael Magnusson