about summary refs log tree commit diff
path: root/Etc
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2019-12-21 12:41:03 +0000
committerDaniel Shahaf <danielsh@apache.org>2019-12-22 03:21:09 +0000
commita0c0aa41d2ac632529f795a02519b1def00b53cc (patch)
treea19dac672a6ae11c8b1209dfe62ae531cb3b329c /Etc
parent105ca83aa2e8c16df4f83754f8b43f349032650c (diff)
downloadzsh-a0c0aa41d2ac632529f795a02519b1def00b53cc.tar.gz
zsh-a0c0aa41d2ac632529f795a02519b1def00b53cc.tar.xz
zsh-a0c0aa41d2ac632529f795a02519b1def00b53cc.zip
45111: zshmisc(1): Clarify the documentation of 'return' and 'exit' in conjunction with try/always
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.
Diffstat (limited to 'Etc')
-rw-r--r--Etc/BUGS3
1 files changed, 0 insertions, 3 deletions
diff --git a/Etc/BUGS b/Etc/BUGS
index 8244677f6..3fbe81831 100644
--- a/Etc/BUGS
+++ b/Etc/BUGS
@@ -39,6 +39,3 @@ fn trap1 trap2
 echo out2
 ]]]
 ------------------------------------------------------------------------
-45075 - Daniel Shahaf - '{ exit } always { foo }' - docs/code mismatch
-and return/exit differences
-------------------------------------------------------------------------