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: Joost Kremers
Subject: Re: Concern around use of eval
Date: 20 Mar 2015 19:54:16 GMT
User-agent: slrn/pre1.0.0-18 (Linux)

Tassilo Horn wrote:
> 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.

Thanks, that explains a few things.


-- 
Joost Kremers                                   address@hidden
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

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