From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Les Harris Newsgroups: gmane.emacs.help Subject: Concern around use of eval Date: Wed, 18 Mar 2015 23:53:51 -0700 Organization: Meta Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426748071 14746 80.91.229.3 (19 Mar 2015 06:54:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2015 06:54:31 +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 07:54:23 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 1YYULW-0008S6-3d for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2015 07:54:22 +0100 Original-Received: from localhost ([::1]:37394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYULV-00026Y-Ha for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Mar 2015 02:54:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYULI-00023q-1Y for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 02:54:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYULC-00059a-Rc for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 02:54:07 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYULC-00059E-KA for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 02:54:02 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YYULB-00089Q-0Z for help-gnu-emacs@gnu.org; Thu, 19 Mar 2015 07:54:01 +0100 Original-Received: from c-73-221-95-202.hsd1.wa.comcast.net ([73.221.95.202]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 19 Mar 2015 07:54:00 +0100 Original-Received: from les by c-73-221-95-202.hsd1.wa.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 19 Mar 2015 07:54:00 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 31 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-73-221-95-202.hsd1.wa.comcast.net X-Face: IIU%0.c15s2*Y@E103$=U#KH)!IoX\dh96~f,; `6*JwSGCX"@(,a=l+iXp30Ra|!K$6/8uW 8RD,5{v!5{oH#81_x2yFuytAm^Cj9?),Rk[1E~"j$/W%Uzk%f)"6}#/NH0^iJKIb7eJF; A%RqJ8Di$ X|b.Cv"jL#1QgKJgs*UYQ~"cc X-Get-A-Life: Don't you have better things to be doing? User-Agent: It's a secret to everybody Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFz UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAA9Q TFRFAAAAPLz9/Jg4iHAA////8qpT8gAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAl2cEFnAAAAMAAA ADAAzu6MVwAAAL9JREFUOMuV0sENgzAMBdBv6ABhAxQWqMoCOXT/mWrHttIcMCZCCP2HHDuA77wa gJc8IAccL3V/AI3jerzT0OtwjiRoXI9TK4UgM8Hj0yrFIFHV+PRKMWDl4GOSgb67mY93A382tRvD ssNsPsQLkAPc0W31hkNooAIoyFMCem6Lymg3gG1j4rusBLSR9c0TwP8xaU5zqRikY9qSIEnxehnQ AR+CHqL1fA9N5yKbb3yoayA/DHshAd4ri1y91iX8ADKmqs3NujZhAAAAJXRFWHRjcmVhdGUtZGF0 ZQAyMDA5LTAxLTMwVDA1OjEyOjMyKzAwOjAwaWad5gAAACV0RVh0bW9kaWZ5LWRhdGUAMjAwOS0w MS0zMFQwNToxMjoxNSswMDowMLFV0iEAAAAASUVORK5CYII= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:103206 Archived-At: I have a situation where I want to generate a bunch of nearly identical predicate functions. Previously I had just manually defined these things one by one but was never happy with such an obvious inefficiency (or maintaining it). Tonight I decided I'd fix this and whacked them and implemented a way of doing it where I can iterate over a list containing labels and define these predicate functions using those labels: ,---- | (defvar lh/labels '("label1" "label2" "label3")) | | (defmacro lh/gen-predicate (label) | `(defun ,(intern (concat "lh/" label "-p")) () | (member ,label *lh/system-label-store*))) | | (defun lh/define-predicates () | (dolist (label lh/labels) | (eval `(lh/gen-predicate ,label)))) | (lh/define-predicates) `---- Now this all works fine and I get my auto-generated predicates, so success. My question/concern/niggle is around the use of (eval) in lh/define-predicates. If I don't put eval in there then the defun the macro evaluates into never gets evaluated itself. Stylistically, is there a better way to do this or am I just being weird about (eval) and should just get over it? -- Do they only stand By ignorance, is that their happy state, The proof of their obedience and their faith?