zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Philippe Altherr <philippe.altherr@gmail.com>, zsh-workers@zsh.org
Subject: Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements
Date: Tue, 22 Nov 2022 10:17:37 +0000 (GMT)	[thread overview]
Message-ID: <1563682955.1031478.1669112257901@mail.virginmedia.com> (raw)
In-Reply-To: <CAGdYchvM8uwvQ9B-S4n_-oMQkNqgZZrqG9jwYCV7Nz+5Lo6Q=w@mail.gmail.com>

On 22/11/2022 02:52 Philippe Altherr <philippe.altherr@gmail.com> 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


  parent reply	other threads:[~2022-11-22 10:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 14:40 Philippe Altherr
2022-11-19 13:39 ` Philippe Altherr
2022-11-21  0:43   ` Bart Schaefer
2022-11-21  7:22     ` Lawrence Velázquez
2022-11-22  2:52       ` Philippe Altherr
2022-11-22  4:51         ` Bart Schaefer
2022-11-22 10:17         ` Peter Stephenson [this message]
2022-11-23  8:11           ` Lawrence Velázquez
2022-11-23  6:59         ` Lawrence Velázquez
2022-11-23  9:43           ` Philippe Altherr
2022-11-23 16:11             ` Bart Schaefer
2022-11-23 20:57               ` Submitting multiple patches (was: Re: [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements) Daniel Shahaf
2022-11-23 21:11                 ` Bart Schaefer
2022-11-23 21:22                   ` Bart Schaefer
2022-11-23 21:54                   ` Bart Schaefer
2022-11-24  2:21                     ` Philippe Altherr
2022-11-26  2:28                       ` Bart Schaefer
2022-11-26  4:02                         ` Philippe Altherr
2022-11-24  1:47               ` [PATCH] Fix ERR_EXIT behavior in function calls and "always" statements Philippe Altherr
2022-11-24  4:28             ` Lawrence Velázquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1563682955.1031478.1669112257901@mail.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=philippe.altherr@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).