zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: Infinite recursions in math evaluation
Date: Fri, 13 May 2011 21:36:33 -0700	[thread overview]
Message-ID: <110513213633.ZM13611@torch.brasslantern.com> (raw)
In-Reply-To: <BANLkTimXmy78=PFk_5Hm0j+4owt0Fb=BNg@mail.gmail.com>

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.

"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 ...


  reply	other threads:[~2011-05-14  4:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13 21:37 Mikael Magnusson
2011-05-14  4:36 ` Bart Schaefer [this message]
2011-05-14  9:03   ` Mikael Magnusson
2011-05-14 18:00     ` Bart Schaefer
2011-05-14 18:09       ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110513213633.ZM13611@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).