all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: Stefan Kangas <stefankangas@gmail.com>, 66816@debbugs.gnu.org
Subject: bug#66816: [PATCH] Delete redundant lambdas around unary functions
Date: Sun, 29 Oct 2023 17:55:27 -0400	[thread overview]
Message-ID: <jwvfs1tm71u.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <1F4EC90D-4A07-4B24-B699-5AC1CC6A8408@gmail.com> ("Mattias Engdegård"'s message of "Sun, 29 Oct 2023 20:03:16 +0100")

The patch looks good to me.

> We could also have the compiler η-reduce automatically. I investigated this
> very briefly some time ago. Maybe I can dig up the patch.
> One problem is that the arity isn't necessarily preserved.

And even if we check the arity before performing the rewrite, the arity
at compile-time may be different from the arity at run-time, so it's not
a safe optimization.

OTOH we could emit a warning :-)

> Most of the time this isn't a problem but it could be something to
> watch out for if doing the η-reduction by hand.

I've been bitten a few times, indeed.


        Stefan






  reply	other threads:[~2023-10-29 21:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29 13:02 bug#66816: [PATCH] Delete redundant lambdas around unary functions Stefan Kangas
2023-10-29 19:03 ` Mattias Engdegård
2023-10-29 21:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-10-30  8:56     ` Mattias Engdegård
2023-10-30 15:00       ` Mattias Engdegård

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=jwvfs1tm71u.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=66816@debbugs.gnu.org \
    --cc=mattias.engdegard@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.