From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: syntax-source Date: Sat, 16 Apr 2011 22:21:54 -0400 Message-ID: <87r5914ny5.fsf@netris.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1303006949 29454 80.91.229.12 (17 Apr 2011 02:22:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 17 Apr 2011 02:22:29 +0000 (UTC) Cc: guile-devel To: Stefan Israelsson Tampe Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 17 04:22:25 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QBHd2-0003ux-4q for guile-devel@m.gmane.org; Sun, 17 Apr 2011 04:22:24 +0200 Original-Received: from localhost ([::1]:43225 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBHd1-0008Gg-LP for guile-devel@m.gmane.org; Sat, 16 Apr 2011 22:22:23 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBHcz-0008FD-J8 for guile-devel@gnu.org; Sat, 16 Apr 2011 22:22:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBHcy-0001Yv-Le for guile-devel@gnu.org; Sat, 16 Apr 2011 22:22:21 -0400 Original-Received: from world.peace.net ([96.39.62.75]:42598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBHcy-0001YV-HG for guile-devel@gnu.org; Sat, 16 Apr 2011 22:22:20 -0400 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1QBHca-0002sJ-TV; Sat, 16 Apr 2011 22:21:57 -0400 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1QBHcY-000600-Dj; Sat, 16 Apr 2011 22:21:54 -0400 In-Reply-To: (Stefan Israelsson Tampe's message of "Sat, 16 Apr 2011 22:12:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12277 Archived-At: Stefan Israelsson Tampe writes: > I want to get source location of a macro form and played a little with > syntax-source. This should then print out something. > > (define-syntax <+> > =C2=A0 (lambda (x) > =C2=A0=C2=A0=C2=A0 (syntax-case x () > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((o a b) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (pk (syntax-source x)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #'(+ a b))))) > > (<+> 1 2) > > In trying to use the location of x resulted in the=C2=A0 toplevel form > location and not the <+> form in a more complex example. and using=C2=A0 > #'o or #'a or #'b in stead of x on syntax-source form will lead to pk > prints out #f. Source properties are associated with source forms using an eq? hash table, and thus work only for parenthesized expressions, not for atoms. See section 6.52.2 of the manual for more on this. Best, Mark