zsh-users
 help / color / mirror / code / Atom feed
From: Ronald Fischer <ynnor@mm.st>
To: Mikael Magnusson <mikachu@gmail.com>,
	"Zsh Mailing-List" <zsh-users@zsh.org>
Subject: Re: Possible bug: Zsh function does not terminate when ${name:?word} fails
Date: Wed, 14 Sep 2016 13:21:15 +0200	[thread overview]
Message-ID: <1473852075.116222.725350673.4067E6E0@webmail.messagingengine.com> (raw)
In-Reply-To: <CAHYJk3T+J8bkGmDxMbOBdFiY1EzsvYajG3tKEHRfJV9Bjk9RZw@mail.gmail.com>

> This seems to be a side effect of the reserved word handling, if you do
> disable -r local
> then it behaves as expected. 

I don't think this would be a good idea. If I understand correctly, this
would make the variables global (with all consequences from a name
clash). There are other nasty consequences too.

A better workaround is IMO to separate parameter check and assignment,
for instance by

: ${foo:?hello}
local p=$foo # foo is guaranteed to have a value here

Ronald


  reply	other threads:[~2016-09-14 11:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160914080154eucas1p11c49e4dd5f0d45f92deaef1ce08099de@eucas1p1.samsung.com>
2016-09-14  8:00 ` Ronald Fischer
2016-09-14  8:19   ` Mikael Magnusson
2016-09-14 11:21     ` Ronald Fischer [this message]
2016-09-14 16:20       ` Bart Schaefer
2016-09-14 19:08         ` Mikael Magnusson
2016-09-14  9:19   ` Peter Stephenson

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=1473852075.116222.725350673.4067E6E0@webmail.messagingengine.com \
    --to=ynnor@mm.st \
    --cc=mikachu@gmail.com \
    --cc=zsh-users@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).