[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recognizing declares in lambdas
From: |
Thuna |
Subject: |
Recognizing declares in lambdas |
Date: |
Tue, 30 Jul 2024 23:29:51 +0200 |
Right now `declare' is essentially a hack; it only works because `def*'
forms recognize and remove it from the lambda which is then passed to
defalias. And due to the unfortunate order of `declare' and
`interactive' forms in defun it is not possible to simply put the
`declare' into the lambda, as that would break any following
`interactive' forms.
This alone is a simple fix - I have attached a PoC patch - but the
question of what to actually do with those declarations is one that is
very wide-reaching and I cannot answer that, much less implement it, on
my own.
One possibility which I am thinking of would be to add another slot to
closures which holds these declare forms and to make function-get and
function-put refer to these slots instead, and while a lot of
declarations would work out of the box with this setup, stuff like gv's
declarations will not.
A solution might be to have `def*' apply and remove the declarations
they recognize in their `*-declarations-alist' and send the rest over to
the `lambda', which *would* conceptually work, but as I have not
actually implemented it might contain pitfalls that I cannot predict at
the moment.
I would like to get some opinions on this. I think that at the very
least lambdas should recognize declares even if they don't do anything
with it.
0001-Recognize-declares-in-lambdas.patch
Description: Patch which makes lambdas recognize declare forms
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Recognizing declares in lambdas,
Thuna <=