On Sun, May 11, 2025, at 2:55 PM, Philippe Altherr wrote:
> I find the manual a little confusing because the first sentence
> mentions an exceptional behavior of return and exit statements. Then
> the last sentence states that otherwise return statements work as
> expected but so do exit statements, except if they are directly within
> a subshell. There is actually no explanation of why such exit
> statements don't trigger the always block.
FWIW, the yodl source Doc/Zsh/grammar.yo contains this:
COMMENT(The semantics of calling 'exit' in try-list inside
a function are deliberately left unspecified, because
historically there was a mismatch between the documented and
implemented behaviours. Cf. 20076, 21734/21735, 45075.)
)
https://sourceforge.net/p/zsh/code/ci/zsh-5.9.0.2-test/tree/Doc/Zsh/grammar.yo
Here are the referenced messages in the mailing list archive:
workers/20076: https://www.zsh.org/mla/workers/2004/msg00729.html
workers/21734: https://www.zsh.org/mla/workers/2005/msg01089.html
workers/21735: https://www.zsh.org/mla/workers/2005/msg01090.html
workers/45075: https://www.zsh.org/mla/workers/2019/msg01107.html
--
vq