zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH 1/2] zshmisc(1): Clarify the documentation of 'return' and 'exit' in conjunction with try/always
Date: Sat, 21 Dec 2019 17:58:35 +0000	[thread overview]
Message-ID: <bdf1b4f1e107c5923790a59c548f15f231d7e093.camel@ntlworld.com> (raw)
In-Reply-To: <20191221124104.22751-1-danielsh@apache.org>

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


  parent reply	other threads:[~2019-12-21 21:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21 12:41 Daniel Shahaf
2019-12-21 12:41 ` [PATCH 2/2] zshmisc(1): Fix markup of "try-list" and "always-list" Daniel Shahaf
2019-12-21 17:58 ` Peter Stephenson [this message]
2019-12-22  3:10   ` [PATCH 1/2] zshmisc(1): Clarify the documentation of 'return' and 'exit' in conjunction with try/always Daniel Shahaf

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=bdf1b4f1e107c5923790a59c548f15f231d7e093.camel@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).