emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A combination of defmacro, functionp, and quoted lambdas yields diff


From: Stefan Monnier
Subject: Re: A combination of defmacro, functionp, and quoted lambdas yields different results on consecutive evaluations
Date: Sun, 25 Feb 2018 22:18:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> * In a new file test-macro.el, write this:
>   
>   (defmacro mmm (f)
>     `(function ,f))
>   (provide 'test-macro)
>
> * In a new file test.el, write this
>
>   (with-eval-after-load 'test-macro
>     (let ((out (mmm (lambda ()))))
>       (message "with-eval-after-load: %S" out)))
>
>   (load (expand-file-name "test-macro.el"))

This is not supposed to work: your test.el uses `mmm` before it gets
defined by the subsequent `load`.

It's true that Emacs doesn't guarantee that it will always fail to work,
but ... you get what you deserve.


        Stefan


PS: BTW, moving the `load` earlier may make it work more often but it
    still wouldn't make it right.  You'd additionally need to replace
    the `load` by `require` or to wrap it inside a `eval-when-compile`.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]