[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 <joost.m.kremers@gmail.com> 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
- Concern around use of eval, Les Harris, 2015/03/19
- Re: Concern around use of eval, Stefan Monnier, 2015/03/19
- Re: Concern around use of eval, Thierry Volpiatto, 2015/03/20
- Message not available
- Re: Bug in Elisp font-locking, Tassilo Horn, 2015/03/20
- Re: Bug in Elisp font-locking, Stefan Monnier, 2015/03/20
- Re: Bug in Elisp font-locking, Tassilo Horn, 2015/03/20
- Re: Bug in Elisp font-locking, Stefan Monnier, 2015/03/20