From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Re: Strange behavior of macro Date: Tue, 30 May 2006 18:31:47 +0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1148985154 12819 80.91.229.2 (30 May 2006 10:32:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 30 May 2006 10:32:34 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 30 12:32:31 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fl1WJ-00044a-7D for ged-emacs-devel@m.gmane.org; Tue, 30 May 2006 12:32:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fl1WI-0001Ic-N7 for ged-emacs-devel@m.gmane.org; Tue, 30 May 2006 06:32:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fl1Vw-0001E3-M1 for emacs-devel@gnu.org; Tue, 30 May 2006 06:31:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fl1Vu-0001DH-TM for emacs-devel@gnu.org; Tue, 30 May 2006 06:31:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fl1Vu-0001DC-Nv for emacs-devel@gnu.org; Tue, 30 May 2006 06:31:50 -0400 Original-Received: from [64.4.26.31] (helo=hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Fl1bg-0006KU-JP for emacs-devel@gnu.org; Tue, 30 May 2006 06:37:48 -0400 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Tue, 30 May 2006 03:31:49 -0700 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Tue, 30 May 2006 10:31:47 GMT X-Originating-IP: [216.145.54.158] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: Original-To: schwab@suse.de X-OriginalArrivalTime: 30 May 2006 10:31:49.0635 (UTC) FILETIME=[425D3D30:01C683D4] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:55472 Archived-At: >From: Andreas Schwab >To: "Herbert Euler" >CC: emacs-devel@gnu.org >Subject: Re: Strange behavior of macro >Date: Tue, 30 May 2006 12:23:49 +0200 > >"Herbert Euler" writes: > > > Is the following in Emacs a expected behavior of macro? > > > > (defmacro m1 (v) > > (let ((len (length (eval v)))) > > `(quote ,len))) > > => m1 >[...] > > (m1 v) > > => error: (wrong-type-argument sequencep v) > >See (elisp)Eval During Expansion. OK, so it's an accepted behavior. Btw, in the test of GNU clisp, it's safe to write such a macro: [1]> (defmacro m1 (v) (let ((len (length (eval v)))) `(quote ,len))) M1 [2]> (m1 '(1 2 3)) 3 [3]> (setq v1 '(1 2 3)) (1 2 3) [4]> (m1 v1) 3 [5]> (setq v v1) (1 2 3) [6]> (m1 v) 3 [7]> Regards, Guanpeng Xu _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/