unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* compiler macros without byte-compilation
@ 2015-03-20  9:44 Nicolas Richard
  2015-03-20 13:42 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Richard @ 2015-03-20  9:44 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-20 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20  9:44 compiler macros without byte-compilation Nicolas Richard
2015-03-20 13:42 ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).