[Top][All Lists]

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

Re: cl-byte-compile-compiler-macro

From: Stefan Monnier
Subject: Re: cl-byte-compile-compiler-macro
Date: Wed, 05 Apr 2006 16:12:36 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Uh, what?  Am I just confused about the terminology you use?


> defmacro most certainly does not provide optional stuff to the compiler.

We're not talking about macros but about compiler-macros.

> defsubst would, but is the result of that called a "compiler macro" while
> the result of "defmacro" isn't?

Yes.  A compiler-macro, contrary to a macro, is only expanded by the
compiler but not by the interpreter, so you can't rely on it
being expanded.  Also it's not expanded if the function is
called indirectly.

> It appears that the current behavior makes it hard to track down the
> problem.  I think the solution should be to create better diagnostics
> for pinpointing the problem instead of removing them completely.

OK, here's the same but with a diagnostic.


Index: bytecomp.el
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/bytecomp.el,v
retrieving revision 2.181
diff -u -u -b -r2.181 bytecomp.el
--- bytecomp.el 13 Jan 2006 09:54:33 -0000      2.181
+++ bytecomp.el 5 Apr 2006 20:11:50 -0000
@@ -2765,6 +2764,14 @@
                (byte-compile-warn "`%s' used from Lisp code\n\
 That command is designed for interactive use only" fn))
           (if (and handler
+                    ;; Make sure that function exists.  This is important
+                    ;; for CL compiler macros since the symbol may be
+                    ;; `cl-byte-compile-compiler-macro' but if CL isn't
+                    ;; loaded, this function doesn't exist.
+                    (or (fboundp handler)
+                        (progn (byte-compile-warn
+                                "Ignoring byte-compiler handler `%S'" handler)
+                               nil))
                    (or (not (byte-compile-version-cond
                        (not (get (get fn 'byte-opcode) 'emacs19-opcode))))

reply via email to

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