[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Q on byte-compile problem
From: |
Drew Adams |
Subject: |
RE: Q on byte-compile problem |
Date: |
Tue, 6 Jun 2006 18:57:17 -0700 |
The compiler macro-expanded the (foo bar) into something that presumably
began (defun bar ...) -- but it did not -evaluate- this. When the
compiler encounters a normal `defun' at top level, it recognizes
thenceforth that the symbol named therein is a valid function. But,
either because of the conditional nature of your (foo bar) or because of
its macro nature (someone who understands byte compilation better,
specify?), the compiler isn't aware that bar will (at load
time!) actually be defined as a function.
Right. Actually, I thought of providing, first, a phony `defun', to quiet
the byte compiler. But I would just end up with multiple-definitions
warnings in that case.
Could the compiler perhaps be made to recognize that a top-level `defun' was
being added to the byte-compiled file, and treat it as a top-level `defun'
is treated? Not a complaint - just wondering if such an enhancement would be
straightforward or tricky.
Here's the thing -- unless defining a function with the macro `foo'
involves the run-time use of other things from the foo library, why not
just have this case use the foo definition as well?
Macro `foo' doesn't just define `bar' using the same `defun' expression. The
point of macro `foo' is that it constructs a different `defun' for its
argument - the body of function `bar' is entirely different, to be able to
take advantage of features in library `foo'. Macro `foo' and the `foo'
functionalities need not be defined in the same library (in fact, they are
not). What's important is that to take advantage of `foo' functionality,
`bar' must be defined with macro `foo'.
Part of the point of byte-compiling is that macros can be expanded and
then later used in an Emacs which does not know about them.
No problem there. Use of library `foo', which the `foo' definition of `bar'
permits, does not mean use of the macro `foo' (at run time). The macro is
only used to construct the proper `defun' to make `bar' be `foo'-enabled.
Thanks for your suggestions and reminders.