From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: syntax-source Date: Sat, 16 Apr 2011 22:12:50 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016e645a4266c01a504a10ec8ab X-Trace: dough.gmane.org 1302984781 5194 80.91.229.12 (16 Apr 2011 20:13:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 16 Apr 2011 20:13:01 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Apr 16 22:12:57 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 1QBBrV-00060I-C0 for guile-devel@m.gmane.org; Sat, 16 Apr 2011 22:12:57 +0200 Original-Received: from localhost ([::1]:33871 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBBrU-00081Y-FP for guile-devel@m.gmane.org; Sat, 16 Apr 2011 16:12:56 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:35081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBBrR-00080e-Cj for guile-devel@gnu.org; Sat, 16 Apr 2011 16:12:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBBrQ-0003G9-EZ for guile-devel@gnu.org; Sat, 16 Apr 2011 16:12:53 -0400 Original-Received: from mail-iw0-f169.google.com ([209.85.214.169]:43925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBBrQ-0003G5-Ba for guile-devel@gnu.org; Sat, 16 Apr 2011 16:12:52 -0400 Original-Received: by iwg8 with SMTP id 8so4267134iwg.0 for ; Sat, 16 Apr 2011 13:12:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=zazAMLd50pQ36NmsVfS+MW3hFrO1DV4WI2gCwcM1oEk=; b=bgZcqD1W225OEWal1LF1cOh+uMaF6XTzZ86t/tXb7/cFxaSbZLefn3HzALLpp6yR1L XTbGA08L6gGUkll6UbL0NLrmbQarSrwioEQWkSaUUsn64W22xDsC3eCKdcZCH2szbcBs dqNC4czf9DgxKzM1xyL3u0kQLtw9UPs7zGhNA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=PGumbF7rCWi/7Qwlz8uID1mtkw2o8PN1SybGfhjnF38k+xksusZ2e71Cp3wIedwYMr 2FLd9nwIKTzeAvfCQeQ0HKeEtiSrNNc0KjJVzmZaeojTMsTT9uQPz1T2n8hg5dtu9paI 3eaF7gk//BCN72ZfUzosMbwVpQuoFE5dViYTs= Original-Received: by 10.231.141.68 with SMTP id l4mr2590658ibu.158.1302984770977; Sat, 16 Apr 2011 13:12:50 -0700 (PDT) Original-Received: by 10.231.183.67 with HTTP; Sat, 16 Apr 2011 13:12:50 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.169 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:12274 Archived-At: --0016e645a4266c01a504a10ec8ab Content-Type: text/plain; charset=ISO-8859-1 Hi, 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 <+> (lambda (x) (syntax-case x () ((o a b) (pk (syntax-source x)) #'(+ a b))))) (<+> 1 2) In trying to use the location of x resulted in the toplevel form location and not the <+> form in a more complex example. and using #'o or #'a or #'b in stead of x on syntax-source form will lead to pk prints out #f. So the question is if it is possible to get a more exact location information of the (<+> 1 2) and in that case how? Anyway a brief discussion how source and meta information is transported in the guile macro framework would be interesting. Regards Stefan --0016e645a4266c01a504a10ec8ab Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I want to get source location of a macro form and played a littl= e with syntax-source.
This should then print out something.

(defi= ne-syntax <+>
=A0 (lambda (x)
=A0=A0=A0 (syntax-case x ()
= =A0=A0=A0=A0=A0 ((o a b)
=A0=A0=A0=A0=A0=A0 (pk (syntax-source x))
=A0=A0=A0=A0=A0=A0 #'(+ a = b)))))

(<+> 1 2)


In trying to use the location of x= resulted in the=A0 toplevel form location and not the <+> form in a = more complex example.
and using=A0 #'o or #'a or #'b in stead of x on syntax-source f= orm will lead to pk prints out #f.

So the question is if it is possi= ble to get a more exact location information of the (<+> 1 2)
and = in that case how?

Anyway a brief discussion how source and meta information is transporte= d in the guile macro framework would be
interesting.

Regards
= Stefan
--0016e645a4266c01a504a10ec8ab--