From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22211 invoked by alias); 8 Jun 2014 20:30:07 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32750 Received: (qmail 20689 invoked from network); 8 Jun 2014 20:29:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [86.6.157.246] X-Spam: 0 X-Authority: v=2.1 cv=f8XGBYCM c=1 sm=1 tr=0 a=BvYiZ/UW0Fmn8Wufq9dPrg==:117 a=BvYiZ/UW0Fmn8Wufq9dPrg==:17 a=NLZqzBF-AAAA:8 a=LGXc4NIGxrIA:10 a=uObrxnre4hsA:10 a=kj9zAlcOel0A:10 a=qc4BS4RhzQJ13fb7R4YA:9 a=CjuIK1q_8ugA:10 a=_dQi-Dcv4p4A:10 Date: Sun, 8 Jun 2014 21:29:50 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: break/continue vs. try-always Message-ID: <20140608212950.7384ba2b@pws-pc.ntlworld.com> In-Reply-To: <20140608204358.4ec607b8@pws-pc.ntlworld.com> References: <140603191227.ZM28198@torch.brasslantern.com> <140604223723.ZM22960@torch.brasslantern.com> <140605085319.ZM4272@torch.brasslantern.com> <20140606215853.0c6ecae9@pws-pc.ntlworld.com> <20140606224523.09d5f22c@pws-pc.ntlworld.com> <140606232250.ZM23057@torch.brasslantern.com> <20140608185401.35bed78f@pws-pc.ntlworld.com> <140608114123.ZM20229@torch.brasslantern.com> <20140608204358.4ec607b8@pws-pc.ntlworld.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 8 Jun 2014 20:43:58 +0100 Peter Stephenson 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. Then no new syntax is required. > Provide you define that the new option (call it localloops for now) is > applied in the outer function on return from the inner, you can do > everything with > > > setopt localoptions localloops > () { > # call user code > } > # localloops is restored on return here and used to cancel breaks / > # contflag before resuming user code at this point. A further thought is we could even flag an error if there was a break or continue pending at this point, since evidently the user tried to do something they shouldn't. Then we could get the continue-outside-a-loop test to work, thought it wouldn't quite be testing the code it was meant to test. pws