From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: wrapping `define-syntax' Date: Wed, 15 Apr 2009 13:41:01 +0200 Message-ID: References: <2bc5f8210904121555v1090cb8ej6602f72beefa2f20@mail.gmail.com> <8763h8rj58.fsf@arudy.ossau.uklinux.net> <2bc5f8210904130655m4275f847x59be764b652eebd0@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1239795826 27452 80.91.229.12 (15 Apr 2009 11:43:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Apr 2009 11:43:46 +0000 (UTC) Cc: Guile Users , Neil Jerram To: Julian Graham Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Apr 15 13:45:03 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lu3Y6-0002se-FA for guile-user@m.gmane.org; Wed, 15 Apr 2009 13:45:02 +0200 Original-Received: from localhost ([127.0.0.1]:57605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lu3Wh-0003GC-73 for guile-user@m.gmane.org; Wed, 15 Apr 2009 07:43:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lu3Ue-0002pj-Nf for guile-user@gnu.org; Wed, 15 Apr 2009 07:41:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lu3Ua-0002nl-3G for guile-user@gnu.org; Wed, 15 Apr 2009 07:41:28 -0400 Original-Received: from [199.232.76.173] (port=43293 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lu3UZ-0002nW-Qw for guile-user@gnu.org; Wed, 15 Apr 2009 07:41:23 -0400 Original-Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19]:64053 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lu3UZ-0006u5-Gc for guile-user@gnu.org; Wed, 15 Apr 2009 07:41:23 -0400 Original-Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 4978CAACC5; Wed, 15 Apr 2009 07:41:23 -0400 (EDT) Original-Received: from unquote (unknown [82.123.180.11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id BDF8FAACC4; Wed, 15 Apr 2009 07:41:19 -0400 (EDT) In-Reply-To: <2bc5f8210904130655m4275f847x59be764b652eebd0@mail.gmail.com> (Julian Graham's message of "Mon, 13 Apr 2009 09:55:28 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 58767EBA-29B2-11DE-A1D0-C121C5FC92D5-02397024!a-sasl-fastnet.pobox.com X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7220 Archived-At: Hi Julian, On Mon 13 Apr 2009 15:55, Julian Graham writes: > Well, in R6RS, the body of `define-syntax' forms is evaluated in a > higher "phase" -- meaning that there are additional bindings visible > while it's being evaluated. The final paragraph of 7.2 seems to imply that these additional bindings may also be present for the runtime phase, which would obviate the need for the temporary modules. > [H]aving the modules containing the phased bindings in the uses list > will make them visible in the closures used by syncase -- which, with > Andy's syncase hygiene changes in place, will lead to the > module-relative `@' forms being produced in the expansion. This means you have to give names to those intermediate modules, because syncase's output has to be serializable. It doesn't seem like named temporary modules are a good idea. Why not import the bindings needed at expansion time, evaluate keyword definitions, then import other bindings needed at runtime, then evaluate variable definitions and expressions? No temporary modules would be necessary. >> Hmm. =C2=A0I don't really have much idea... but given that define-syntax= is >> syntax, does (define-syntax canonical-define-syntax define-syntax) >> work any better? > > Nope: ERROR: invalid syntax define-syntax I believe this is the correct incantation, but that our version of psyntax punts on the issue. I think that it tries to expand the right-hand side normally, but `define-syntax' as a bare keyword is invalid syntax. (It could be an identifier syntax, after all.) I don't know if syntax-case has a particular idiom for this (renaming an existing macro at the toplevel, not lexically), or if we should hack in a special case. Cheers, Andy --=20 http://wingolog.org/