zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Function code breaking out of if then ...fi
Date: Fri, 09 Nov 2012 17:13:19 -0800	[thread overview]
Message-ID: <121109171319.ZM4069@torch.brasslantern.com> (raw)
In-Reply-To: <20121109225255.7139bb47@pws-pc.ntlworld.com>

On Nov 9, 10:52pm, Peter Stephenson wrote:
}
} On the behaviour that when the shell encounters a "fatal" error in a
} script it resumes at the next "top level" command:  here's a proposal.
} This makes that behaviour optional, for compatibility, but turns it off
} by default.  I don't think the old, undocumented, behaviour is intuitive
} enough for us to go on leaving it as the default.  The shell essentially
} skips a chunk of code and resumes later on at a point where there's not
} the slightest reason to suppose it's appropriate to do so; you might be
} relying on the structure that was previously executing to set things up
} for the next chunk of code.

I believe I know the reason for this behavior, and perhaps it points to a
bug:

When reading a startup file such as .zshrc, there is an intent to avoid
skipping the entire configuration just because of one erroneous command
somewhere in the middle.

My possibly flawed recollection was that this was only supposed to happen
in startup scripts, not in scripts run as standalone programs or loaded
by "source" or ".".

If this patch modifies the behavior of startup files, perhaps one further
step would be to turn on CONTINUE_ON_ERROR before startup files are read,
then turn it off before entering the main loop iff the starup files
themselves have not frobbed it.  I believe something similar is done
with MONITOR and also HASHDIRS.


  reply	other threads:[~2012-11-10  1:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-02  9:09 Michal Maruska
2012-11-02 21:39 ` Bart Schaefer
2012-11-05  8:22   ` Han Pingtian
2012-11-05  9:31     ` Han Pingtian
2012-11-05 14:29   ` Peter Stephenson
2012-11-05 14:55     ` Peter Stephenson
2012-11-05 16:08       ` Peter Stephenson
2012-11-06  6:47         ` Han Pingtian
2012-11-09 22:52       ` Peter Stephenson
2012-11-10  1:13         ` Bart Schaefer [this message]
2012-11-10 21:23           ` Peter Stephenson
2012-11-12 10:24             ` 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=121109171319.ZM4069@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).