zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: break/continue vs. try-always
Date: Sun, 8 Jun 2014 22:50:35 +0100	[thread overview]
Message-ID: <20140608225035.078a86a8@pws-pc.ntlworld.com> (raw)
In-Reply-To: <140608140146.ZM20431@torch.brasslantern.com>

On Sun, 08 Jun 2014 14:01:46 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> } If you like the idea of function scope as a sandbox, it seems me that a
> } neater way to handle this would be to add an option to force break and
> } continue to respect function scope.
> 
> The problem with that solution is that it propagates downward -- it's
> the inverse of break/continue propagating upward.  There may be layers
> of function scope in between the caller and the eventual break/continue
> that expect the current dynamic-scope behavior.

This is why I pointed out you could do

 
setopt localoptions localloops
() {
   setopt nolocalloops # or emulation or whatever
   # call user code
}
# localloops is restored on return here and used to cancel breaks /
# contflag before resuming user code at this point.


because the restore behaviour is in the caller.  It doesn't seem to me
any different from the fact that any option at all could be misset for a
particular type of function, so the function needs to set them up with
an emulation.

I wouldn't expect anything more than a very exceptional wrapper to break
and continue to rely on that behaviour.

pws


  reply	other threads:[~2014-06-08 21:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04  2:12 Oddball output from zerrmsg() Bart Schaefer
2014-06-05  5:37 ` [PATCH] " Bart Schaefer
2014-06-05 15:53   ` break/continue vs. try-always Bart Schaefer
2014-06-06 20:58     ` Peter Stephenson
2014-06-06 21:08       ` Bart Schaefer
2014-06-06 21:45         ` Peter Stephenson
2014-06-07  6:22           ` Bart Schaefer
2014-06-08 17:54             ` Peter Stephenson
2014-06-08 18:41               ` Bart Schaefer
2014-06-08 19:43                 ` Peter Stephenson
2014-06-08 20:29                   ` Peter Stephenson
2014-06-08 21:01                   ` Bart Schaefer
2014-06-08 21:50                     ` Peter Stephenson [this message]
2014-06-09  2:11                       ` Bart Schaefer
2014-06-12 19:35                         ` Peter Stephenson
2014-06-13  6:57                           ` Bart Schaefer
2014-06-13  9:55                             ` 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=20140608225035.078a86a8@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).