From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Concern around use of eval Date: Thu, 19 Mar 2015 09:31:17 +0100 Message-ID: <87d2458k2y.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426753901 6111 80.91.229.3 (19 Mar 2015 08:31:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2015 08:31:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 19 09:31:35 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YYVrb-0000bU-4q for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2015 09:31:35 +0100 Original-Received: from localhost ([::1]:37702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYVra-0004G6-58 for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2015 04:31:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYVrO-0004EG-D9 for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 04:31:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYVrL-00026B-7G for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 04:31:22 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:34940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYVrL-00025z-1A for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 04:31:19 -0400 Original-Received: from thinkpad-t440p (dhcp132.uni-koblenz.de [141.26.71.132]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTPSA id 15B311A8488 for ; Thu, 19 Mar 2015 09:31:18 +0100 (CET) Mail-Followup-To: help-gnu-emacs@gnu.org In-Reply-To: (Joost Kremers's message of "19 Mar 2015 08:12:04 GMT") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 141.26.64.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103211 Archived-At: Joost Kremers 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