From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12465 invoked by alias); 11 Mar 2014 03:33:12 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18583 Received: (qmail 6781 invoked from network); 11 Mar 2014 03:33:08 -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=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Wz3amLbJez6G5C9tvgthKmFHAsCFe8hUt21eMh60Iok=; b=LnXAev5R6ABWofJFsXTZWo3T+k/DkQyT+HJ+Om/umLCP5PSWjo2BoX80DzD4obpjnQ D7sxs15o5xZki4LDDstC6E1IVqCTArqwtnKolECZV25Y/7gxfw6gOCwK2MFkvLZOLU4+ RpU/4AktZmVtnP5kr6IpXxibCt0fTQB3KqP75hdWDXbxtuDnATQ+XwCYyPdGUiT3W+zY a5hbPJsG4um1mEq+S4ZSC1dPuaNAFY0Vv4bdGDzvH/zGO6n27o2rZ/3UxtwFuzqNquUU 9G82STRLpEYJ3+vv07XhCEcRcjfzrjzRJCazEWAlf6v0la4Gez5XkSaHOj8K1yx7mvQ5 acnQ== X-Gm-Message-State: ALoCoQnNaeHzsxIJ9PkfRC6aIcOadAOf0HsQUPoaBSUiBzmgCmCEByDlIZcOKFDF8wX6TiiUbyAa MIME-Version: 1.0 X-Received: by 10.68.99.194 with SMTP id es2mr44778707pbb.100.1394508782233; Mon, 10 Mar 2014 20:33:02 -0700 (PDT) In-Reply-To: <531E7C37.9070302@eastlink.ca> References: <140310083224.ZM10646@torch.brasslantern.com> <531E0393.6060106@eastlink.ca> <20140310194239.0a3bde92@pws-pc.ntlworld.com> <531E7C37.9070302@eastlink.ca> Date: Mon, 10 Mar 2014 20:33:02 -0700 Message-ID: Subject: Re: return up two levels? From: Kurtis Rader To: Ray Andrews Cc: Zsh Users Content-Type: multipart/alternative; boundary=047d7b86f62e99fd9304f44c609f --047d7b86f62e99fd9304f44c609f Content-Type: text/plain; charset=UTF-8 Please don't use that technique unless it's in the context of something atypical like a debugger. It's a really bad software pattern. It's spooky action at a distance. It's a form of monkey-patching. it practically guarantees hard to debug errors. Plus a large number of other problems. Don't do it. Be explicit about return values. If you want a caller of function2 to exit immediately have function2 return non-zero and test for that. For example, function2() { print I failed to do my job; return 1 } function1() { if ! function2; then; print unexpected failure; return 0; fi; print life is good } On Mon, Mar 10, 2014 at 8:00 PM, Ray Andrews wrote: > On 03/10/2014 12:42 PM, Peter Stephenson wrote: > > Peter: > >> function1() { function2; print Doesn\'t get called; } >> function2() { trap 'return' EXIT; print Does get called; } >> > Thanks, that about does it. I've not used traps up till now. > > BTW I'm enjoying your book. Hats off to Oliver as well of course. > > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank --047d7b86f62e99fd9304f44c609f--