help-gnu-emacs
[Top][All Lists]
Advanced

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

compiler macros without byte-compilation


From: Nicolas Richard
Subject: compiler macros without byte-compilation
Date: Fri, 20 Mar 2015 10:44:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hello,

Consider the following:
(progn
  (defun foobar ()
    (declare (compiler-macro
              (lambda (arg)
                "compiler-macro")))
    (message "Done !"))
  (list (symbol-function 'foobar)
        (foobar)))
hit C-x C-e :
 => ((lambda nil (message "Done !")) "compiler-macro")

Now I'm puzzled : why does this happen ? foobar wasn't compiled here !

Looking at readevalloop in lread.c, I thought it was maybe because of
eager macro expansion [which the manual only mentions as happenning at
load time], and in particular I tried changing (symbol-function
'internal-macroexpand-for-load), but that doens't seem to have any
influence on the above behaviour:

(cl-letf (((symbol-function 'internal-macroexpand-for-load) nil))
  (progn
    (defun foobar ()
      (declare (compiler-macro
                (lambda (arg)
                  "compiler-macro")))
      (message "Done !"))
    (list (symbol-function 'foobar)
          (foobar))))
 => ((lambda nil (message "Done !")) "compiler-macro")

Could someone shed some light on this ?

-- 
Nicolas Richard



reply via email to

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