From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marco Maggi Newsgroups: gmane.lisp.guile.devel Subject: Re: define-syntax Date: Wed, 16 Jun 2010 09:35:25 +0200 Message-ID: <87631jqvk2.fsf@rapitore.luna> References: <87bpbcm381.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1276673743 5944 80.91.229.12 (16 Jun 2010 07:35:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 16 Jun 2010 07:35:43 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-15?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jun 16 09:35:41 2010 connect(): No such file or directory Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OOn9x-0003Ww-22 for guile-devel@m.gmane.org; Wed, 16 Jun 2010 09:35:41 +0200 Original-Received: from localhost ([127.0.0.1]:44463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOn9w-0000bF-Bu for guile-devel@m.gmane.org; Wed, 16 Jun 2010 03:35:40 -0400 Original-Received: from [140.186.70.92] (port=38913 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOn9I-0000Kx-N4 for guile-devel@gnu.org; Wed, 16 Jun 2010 03:35:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOn9H-0003dP-FZ for guile-devel@gnu.org; Wed, 16 Jun 2010 03:35:00 -0400 Original-Received: from relay-pt1.poste.it ([62.241.4.164]:58171) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOn9E-0003c6-60; Wed, 16 Jun 2010 03:34:56 -0400 Original-Received: from rapitore.luna (93.147.77.55) by relay-pt1.poste.it (8.5.121.01) (authenticated as marco.maggi-ipsu@poste.it) id 4C1814820000B903; Wed, 16 Jun 2010 09:34:53 +0200 Original-Sender: marco@localhost X-Loop: marco@maggi.it X-Mailer: GNU Emacs In-Reply-To: marco@localhost Jun 2010 22:48:46 +0200") Original-Lines: 71 X-detected-operating-system: by eggs.gnu.org: Solaris 9 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10501 Archived-At: "Ludovic Court=A8=A8s" wrote: > (define-syntax + > (let ((plus +)) I am assuming you are starting the program with: (import (rnrs)) or you are importing at level 1 a library which exports "+"; if this is the case, and you want R6RS compatibility, IMHO this should fail because you are redefining the binding for "+"; many R6RS implementations agree with this (with the exception of Ypsilon which has hygiene problems and must not be taken as model). Notice that bindings from "(rnrs)" are imported at both levels 0 and 1[1]: For the libraries defined in the library report, the export level is 0 for nearly all bindings. The exceptions are syntax-rules, identifier-syntax, ..., and _ from the (rnrs base (6)) library, which are exported with level 1, set! from the (rnrs base (6)) library, which is exported with levels 0 and 1, and all bindings from the composite (rnrs (6)) library (see library chapter on =A1=B0Composite library=A1=B1), which are exported with levels 0 and 1. As a side note: the existence of the binding for the keyword can be recorded by SYNTAX in the right-hand side of a DEFINE-SYNTAX, so that the binding itself is can be used to refer to the context of the definition: (import (rnrs)) (define ciao 123) (define-syntax this (lambda (stx) (syntax-case stx () ((_) (datum->syntax #'this 'ciao))))) (write (this)) (newline) and also: (import (rnrs)) (define ciao 123) (define-syntax this (let ((ctx #'this)) (lambda (stx) (syntax-case stx () ((_) (datum->syntax ctx 'ciao)))))) (write (this)) (newline) for this kind of things, I suggest taking the behaviour of Larceny as model: if it works with it, it will probably work with all the other R6RS implementations. HTH [1] --=20 Marco Maggi