Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements
- X-seq: zsh-workers 51023
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements
- Date: Tue, 22 Nov 2022 10:17:37 +0000 (GMT)
- Archived-at: <https://zsh.org/workers/51023>
- Importance: Normal
- In-reply-to: <CAGdYchvM8uwvQ9B-S4n_-oMQkNqgZZrqG9jwYCV7Nz+5Lo6Q=w@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchvfLWmxrCZ3-8ThXdyeuMAUWbV=SqFrXCjSJ8AnWpek9A@mail.gmail.com> <CAGdYchufLwUgpKVU6b5eOiF15p0njFr59H1q9XizypwNjzqKzw@mail.gmail.com> <CAH+w=7ZLr8R_pQfpcAdHiNyYH0K_A8ha815nz1zPBakYmCJ6Dg@mail.gmail.com> <230a78bb-fa97-4f3a-94a2-86982316274b@app.fastmail.com> <CAGdYchvM8uwvQ9B-S4n_-oMQkNqgZZrqG9jwYCV7Nz+5Lo6Q=w@mail.gmail.com>
On 22/11/2022 02:52 Philippe Altherr <philippe.altherr@xxxxxxxxx> wrote:
> Currently anonymous functions behave like function calls. My patches
> don't change that but they change/fix cases F and I to behave as mandated
> by POSIX. If anonymous functions are changed to behave like compound
> commands then anonymous functions behave as if the code was inlined.
> This changes the behavior of case E, which currently exits.
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.
(One possible comparison is Ruby, where you consistently either get "yield
semantics" or "function semantics", though comparing zsh with Ruby feels
wrong at pretty much every other level so this is a very shallow similarity
indeed.)
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author