Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug or Feature? Always block triggered by return in subshell within function
- X-seq: zsh-workers 53583
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Philippe Altherr" <philippe.altherr@xxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: Bug or Feature? Always block triggered by return in subshell within function
- Date: Sun, 11 May 2025 16:27:52 -0400
- Archived-at: <https://zsh.org/workers/53583>
- Feedback-id: iaa214773:Fastmail
- In-reply-to: <CAGdYchuowr=nk=mdN25p6bUqTFvp=S1Sf6p-JVPjzCcMCEeHfQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchuowr=nk=mdN25p6bUqTFvp=S1Sf6p-JVPjzCcMCEeHfQ@mail.gmail.com>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author