help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: understanding backquote


From: Pascal J. Bourguignon
Subject: Re: understanding backquote
Date: Wed, 03 Jun 2015 01:07:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Olaf Rogalsky <olaf.rogalsky@aol.de> writes:

> Is there a way to evaluate parts of a defun during read-time or
> byte-compile-time?

In emacs lisp, there's no way to evaluate anything at read-time.
In Common Lisp, you can use the #. dispatching reader macro.

In both emacs lisp and Common Lisp, you can use a toplevel eval-when
form to choose when to evaluate something only at compilation time, but
this doesn't work for subforms.  Notice that some operators have an
"evaluate at compilation-time" rule, but again, this is more clearly
defined for Common Lisp than emacs lisp.

For example CL defconstant says:

    If a defconstant form appears as a top level form, the compiler must
    recognize that name names a constant variable. An implementation may
    choose to evaluate the value-form at compile time, load time, or
    both.  Therefore, users must ensure that the initial-value can be
    evaluated at compile time (regardless of whether or not references
    to name appear in the file) and that it always evaluates to the same
    value.

while the documentation for defconst doesn't say anything about this.


-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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