-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add elpaca-thunk
macro
#173
base: fix/thunk
Are you sure you want to change the base?
Conversation
Thanks for taking the time to write a patch. |
The last commit adds an example file that uses |
Thanks for adding that.
I haven't experimented with compiler-macros much, but I was curious how |
Compiler macro cannot solve the problem, because they are for implementing optimizing semantics for functions. Here we want an alternative semantics altogether, not simply optimizing (i.e. observationally equivalent). Moreover, even with our current macro approach, there’s no reliable means for a macro to decide the exact bootstrap-time dependency of the body. On this topic, what In conclusion, I’m afraid there’s nothing that solves the dependency problem better than a conscious Elisp programmer does. |
Can you give an example of how the "unsoundness" of eval-after-load would cause a practical problem. It would help me understand the limitation of such an approach. |
Phase mismatch will expose the difference in behavior, as is the case with (eval-after-load 'foo
'(foo-macro ...)) This works for interpreted, but not compiled code! Compiler macros are not supposed to change the behavior of the code. From a user’s perspective, this is as confusing as it can get, as the code is explicitly |
The same issue exists with (with-eval-after-load 'test
(test (message "PASS")))
(defmacro test (&rest body)
"Test BODY."
`(progn ,@body))
(provide 'test) Will still warn about the macro This emacs-devel thread discusses the issues: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00516.html And it looks like it boils down to (as far as Stefan is concerned) to "don't use a macro" or "quote what you want to hide from the macro-exapnsion and (therefore) the byte-compiler". I'll have to think on this more, but my goal is to keep things pragmatic and simple. |
This patch provides a new
elpaca-thunk
macro that wraps the body directly in a thunk as opposed to aneval
ed form. The main expansion logic is abstracted into a separate function, which in turn is used by both the oldelpaca
and the newelpaca-thunk
macros. The new macro is potentially useful to advanced users who want a more reliable compiled semantics.