[Top][All Lists]

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

Re: doc eval-when-compile, eval-and-compile

From: Stefan Monnier
Subject: Re: doc eval-when-compile, eval-and-compile
Date: Mon, 24 Oct 2005 19:00:15 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Below is my go at something like that for the manual.  I think the
> eval-when-compile bit is quite nice, but I couldn't think of much good
> to say about eval-and-compile.  If eval-when-compile is the more often
> used then putting it first in the node might be good.

I've never used eval-and-compile.

> I see eval-and-compile has been used around autoloads like the
> following from gnus, but this is unnecessary now, is it?

>       (eval-and-compile
>         (autoload 'password-read "password"))

It's probably not unnecessary: the evaluation at compile-time is used
so that the byte-compiler knows the function exists and doesn't put out
warnings about its use.  I.e. it works around the fact that the
byte-compiler does not natively understand that `autoload' "defines"
a function.

More commonly the autoload is in another file which is `require'd, so it's
evaluated both at compile and at run time, with the same end result but
without using eval-and-compile.


reply via email to

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