Mercurial > emacs
comparison lispref/compile.texi @ 71263:1d43c64436be
(Eval During Compile): Fix a typo. Add index entries for possible uses of
eval-when-compile.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 07 Jun 2006 17:53:03 +0000 |
parents | f7aff7b6d4af |
children | 6d19c76d81c5 e1bbe296602a |
comparison
equal
deleted
inserted
replaced
71262:70b055c73c8c | 71263:1d43c64436be |
---|---|
433 the compiled program is loaded. The result of evaluation by the | 433 the compiled program is loaded. The result of evaluation by the |
434 compiler becomes a constant which appears in the compiled program. If | 434 compiler becomes a constant which appears in the compiled program. If |
435 you load the source file, rather than compiling it, @var{body} is | 435 you load the source file, rather than compiling it, @var{body} is |
436 evaluated normally. | 436 evaluated normally. |
437 | 437 |
438 @cindex compile-time constant | |
438 If you have a constant that needs some calculation to produce, | 439 If you have a constant that needs some calculation to produce, |
439 @code{eval-when-compile} can do that done at compile-time. For | 440 @code{eval-when-compile} can do that at compile-time. For example, |
440 example, | |
441 | 441 |
442 @lisp | 442 @lisp |
443 (defvar my-regexp | 443 (defvar my-regexp |
444 (eval-when-compile (regexp-opt '("aaa" "aba" "abb")))) | 444 (eval-when-compile (regexp-opt '("aaa" "aba" "abb")))) |
445 @end lisp | 445 @end lisp |
446 | 446 |
447 @cindex macros, at compile time | |
447 If you're using another package, but only need macros from it (the | 448 If you're using another package, but only need macros from it (the |
448 byte compiler will expand those), then @code{eval-when-compile} can be | 449 byte compiler will expand those), then @code{eval-when-compile} can be |
449 used to load it for compiling, but not executing. For example, | 450 used to load it for compiling, but not executing. For example, |
450 | 451 |
451 @lisp | 452 @lisp |