[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#66816: [PATCH] Delete redundant lambdas around unary functions
From: |
Stefan Monnier |
Subject: |
bug#66816: [PATCH] Delete redundant lambdas around unary functions |
Date: |
Sun, 29 Oct 2023 17:55:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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