[Top][All Lists]

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

Re: eval-when-compile and require

From: tomas
Subject: Re: eval-when-compile and require
Date: Tue, 21 Nov 2017 08:29:13 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Hash: SHA1

On Tue, Nov 21, 2017 at 05:05:00AM +0100, Emanuel Berg wrote:
> I'm reading on with the intention of preparing
> the pack for MELPA and now it says [1]
>     If you use many functions and variables
>     from a certain file, you can add
>     a ‘require’ for that package to avoid
>     compilation warnings for them.
>     For instance,
>               (eval-when-compile
>                 (require 'foo))

You use this when you require foo's services at compile

The most common case would be that you require macro
definitions from foo: there, (require 'foo) would
arrive too late. The compiler is the one which has to
expand the macros, so their definitions are needed
during the compile phase.

Another example would be to do some pre-calculation
you don't want to repeat at run time (because it takes
too long, or because you want to make sure that its
results stay stable)

Note that when you need something *both* at compile
and at run time, eval-and-compile is your friend.

> Here I'm not following. Of course the stuff
> should be compiled. And if it isn't, the above
> enclosement with `eval-when-compile' helps
> by... breaking it?

Hm. What gets broken?

> Besides there are no warnings with plain
> `require', so what does it all mean?

Then you don't seem to need whatever foo provides at
compile time => you only need a plain "require".

That's fine.

- -- t
Version: GnuPG v1.4.12 (GNU/Linux)


reply via email to

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