[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defvars at compile time
From: |
Stefan Monnier |
Subject: |
Re: defvars at compile time |
Date: |
Fri, 16 Sep 2005 11:48:43 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> There's almost zero semantics in `(eval-when-compile (defvar xxx))'.
There is: it says someting along the lines of "evaluate (defvar foo) during
byte-compilation". Now evaluating (defvar foo) has *zero* effect, so the
above code is equivalent to not writing anything.
It's only by chance that the byte-compiler actually looks at the contents of
`eval-when-compile' (rather than just passing it to `eval') and finds the
`defvar' which it interprets then as a kind of "extern" declaration.
So when writing the above code, you're relying on undocumented
implementation details of the byte-compiler.
Also it takes more visual space, and more byte-compile time.
The form (defvar foo) was specifically designed as a byte-compiler
directive, so please make use of it.
Stefan