Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Infinite recursions in math evaluation
- X-seq: zsh-workers 29279
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Infinite recursions in math evaluation
- Date: Sat, 14 May 2011 11:03:36 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- 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=
- In-reply-to: <110513213633.ZM13611@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <BANLkTimXmy78=PFk_5Hm0j+4owt0Fb=BNg@mail.gmail.com> <110513213633.ZM13611@torch.brasslantern.com>
On 14 May 2011 06:36, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author