[Top][All Lists]

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

RE: address@hidden: RE:weirddefadvicebugwithbyte-compilation]

From: Drew Adams
Subject: RE: address@hidden: RE:weirddefadvicebugwithbyte-compilation]
Date: Tue, 13 Dec 2005 19:41:59 -0800

    > And I wonder about the behavior of the on-the-fly defadvice
    > byte-compiling. Again, I'm no doubt confused about that - I'd like
    > to understand what's happening there and why.
    See `ad-default-compilation-action'.
Thanks very much. I never heard of that variable. Or, I may have read about it, 
but never paid adequate attention. Here is its doc string:

 Defines whether to compile advised definitions during activation.
 A value of `always' will result in unconditional compilation, `never' will
 always avoid compilation, `maybe' will compile if the byte-compiler is already
 loaded, and `like-original' will compile if the original definition of the
 advised function is compiled or a built-in function.  Every other value will
 be interpreted as `maybe'.  This variable will only be considered if the
 COMPILE argument of `ad-activate' was supplied as nil.

The default value is `maybe', and that's the value I had. The doc string says 
that that means that activation will also compile - if the byte-compiler is 
already loaded. I have no idea what loads the byte compiler, or why its being 
loaded would be the criterion applied here, but I must assume that in my case 
it was already loaded, and that that is the default situation (?). How to tell 
if it is loaded?

The doc string also says that this only happens if the COMPILE arg to 
ad-activate is nil. Well, I never explicitly called ad-activate, with or 
without a COMPILE arg - I used only defadvice. But I guess the `compile' FLAG 
for defadvice acts like the COMPILE arg to ad-activate in this regard (not 
mentioned in the doc string). Is that correct?

Does this all seem a bit convoluted to anyone besides me? Does anyone else 
think that, at the very least, the doc string of defadvice should clarify that 
the meaning of not using the `compile' flag can be overridden by the value of 
`ad-default-compilation-action' - depending on that variable's value, and that 
it will be overridden by the default value (`maybe') in the default 
configuration (byte-compiler loaded)?

What goes for the doc string of defadvice also goes for the description in Info 

Apparently, the already elaborate description of defadvice in Info (node 
"Defining Advice") is far from being enough for someone to understand how to 
use defadvice in even a simple case.

reply via email to

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