From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26916 invoked from network); 17 Aug 2000 20:54:02 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 17 Aug 2000 20:54:02 -0000 Received: (qmail 25652 invoked by alias); 17 Aug 2000 20:53:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12673 Received: (qmail 25644 invoked from network); 17 Aug 2000 20:53:48 -0000 Date: Thu, 17 Aug 2000 13:53:42 -0700 (PDT) From: Bart Schaefer Sender: schaefer@aztec.zanshin.com Reply-To: Bart Schaefer To: Dan Nelson cc: zsh-workers@sunsite.auc.dk Subject: Re: 3.0.8 math bug? In-Reply-To: <20000817125441.A20946@dan.emsphone.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 17 Aug 2000, Dan Nelson wrote: > Why does evaluating a non-numeric variable cause 3.0.8 to consume all > available RAM and then exit to the parent shell? The operational answer is "because all previous versions of zsh do that, and it hasn't been fixed yet in 3.0.8." The semantic answer is "because the value of a variable evaluated in math context is treated as an expression, and that expression is itself evaluated." E.g. b=7 a=b (( a )) --> b --> 7 a="3 + 4" (( a )) --> 3 + 4 --> 7 a=a (( a )) --> a --> a --> a --> ... Hence in 3.1.somethingmorethan6butIforgetwhat, an arbitrary limit on the depth of math recursion was imposed, and you get: > zsh: math recursion limit exceeded This does mean that there are expressions you can evaluate in 3.0.8 that will eventually resolve to a value, which you can't evaluate in 3.1.9. They're a lot more complicated than anything you'd be likely to write out by hand, though.