Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements
On Tue, Nov 22, 2022, at 5:17 AM, Peter Stephenson wrote:
> On the whole I think keeping anonymous functions behaving like other functions
> is probably sensible, though we could draw better attention to this unusual
> degree of consistency somewhere in the documentation.
>
> I don't think there's a killer argument for this but if you're using an
> anonymous function it's because you need some form of function behaviour and
> my own inclination would be to continue to provide essentially the whole of it,
> hopefully also limiting special cases in the source code.
There would certainly be value in permitting
set -e
foo() { cmd1; cmd2; cmd3 }
foo
unset -f foo
to be simplified to
set -e
() { cmd1; cmd2; cmd3 }
while maintaining the same early-exit behavior. That consistency
might be more useful than strict adherence to the syntax-based logic
of POSIX "set -e". Plus, as Bart noted, the (...) exception has
already set a precedent for special treatment.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author