From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c1028c82 for ; Sat, 21 Dec 2019 21:06:52 +0000 (UTC) Received: (qmail 9462 invoked by alias); 21 Dec 2019 17:59:18 -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: List-Unsubscribe: X-Seq: 45120 Received: (qmail 452 invoked by uid 1010); 21 Dec 2019 17:59:17 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-11.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25663. spamassassin: 3.4.2. Clear:RC:0(80.0.253.75):SA:0(-2.0/5.0):. Processed in 2.373303 secs); 21 Dec 2019 17:59:17 -0000 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _smtprelay.virginmedia.com designates 80.0.253.75 as permitted sender) X-Originating-IP: [86.16.88.158] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.3 cv=d/JBNirE c=1 sm=1 tr=0 a=MiHCjVqLJ44lE3bxSlffFQ==:117 a=MiHCjVqLJ44lE3bxSlffFQ==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=IkcTkHD0fZMA:10 a=i0r7pYtpszf5Pv4EwqgA:9 a=QEXdDO2ut3YA:10 Message-ID: Subject: Re: [PATCH 1/2] zshmisc(1): Clarify the documentation of 'return' and 'exit' in conjunction with try/always From: Peter Stephenson To: zsh-workers@zsh.org Date: Sat, 21 Dec 2019 17:58:35 +0000 In-Reply-To: <20191221124104.22751-1-danielsh@apache.org> References: <20191221124104.22751-1-danielsh@apache.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfNwJkxmABU1NceaBBOjKThrOHb46sYVeqSfv6CZUGNr7Zrra4g6+1O6darmWvDWRhxp+ZSTOWT0OzKpfXyQLCQcxm5oBz9bTZEAzKp9jrHpO4kW3fHYo 765m7/e8AVGhW3+tYWZ3sNgq6RvrRMPUMFlKOQmgm0xibwE14crNwXAr On Sat, 2019-12-21 at 12:41 +0000, Daniel Shahaf wrote: > Having reviewed 20076, 20084, 21734, and 21735, my understanding is that > the original intention was: > > - A 'return' in a function does run always-list > - An 'exit' outside a function does not run always-list > - A 'return' outside a function is treated as an 'exit' > > All of which are the case today. The remaining case, of 'exit' used > inside a function, was not specified by the referenced -workers@ posts; > does, as implemented, run the always-list; and furthermore, based in > 21734 it's fair to assume that the original documentation was assuming > that 'exit' would be used outside of any function, just like it assumed > 'return' would be used inside a function. > > Therefore, have the documentation specify only the behaviour of 'exit' > outside any function, and leave the behaviour of 'exit' inside > a function unspecified. Anyone who relied on the documentation of 'exit' > as documented until this commit would have run into the > documentation/implementation discrepancy described in 45075. That seems fine. I don't think it would be problematic to document the current behaviour of exit in a functoin, actually, with the implication it won't suddenly change as I can't see why it would, but leaving the implicit assumption that return is the standard way to get out of a function and otherwise you're in uncharted territory seems fine, too. pws