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

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

Re: Concern around use of eval


From: Tassilo Horn
Subject: Re: Concern around use of eval
Date: Thu, 19 Mar 2015 09:31:17 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Joost Kremers <address@hidden> writes:

> Why not do it at the top level directly? E.g.:
>
> ,----
> | (defvar lh/labels '("label1" "label2" "label3"))
> | 
> | (defmacro lh/gen-predicate (label)
> |   `(defun ,(intern (concat "lh/" label "-p")) ()
> |      (member ,label *lh/system-label-store*)))
> | 
> | (mapc (lambda (label)
> |         (lh/gen-predicate label))
> |       lh/labels)
> `----

That won't work because.  When reading the mapc form, emacs sees that
`lh/gen-predicate' is a macro and tries to expand it with the symbol
label as argument.  The macroexpansion takes place before the actual
execution of the code.

Bye,
Tassilo



reply via email to

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