From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: [bug #31472] Probable psyntax bug with multiple defininitions in the macro expansion Date: Sun, 27 Feb 2011 12:33:51 +0000 Message-ID: <20110227-123349.sv20118.5365@savannah.gnu.org> References: <20101026-224227.sv12227.22452@savannah.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=UTF-8 X-Trace: dough.gmane.org 1298809823 20766 80.91.229.12 (27 Feb 2011 12:30:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 Feb 2011 12:30:23 +0000 (UTC) To: Andreas Rottmann , Andy Wingo , bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Feb 27 13:30:19 2011 Return-path: Envelope-to: guile-bugs@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 1PtflS-0007jX-VC for guile-bugs@m.gmane.org; Sun, 27 Feb 2011 13:30:19 +0100 Original-Received: from localhost ([127.0.0.1]:35028 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtflS-0007O0-7W for guile-bugs@m.gmane.org; Sun, 27 Feb 2011 07:30:18 -0500 Original-Received: from [140.186.70.92] (port=35457 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PtflM-0007Ng-Kw for bug-guile@gnu.org; Sun, 27 Feb 2011 07:30:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PtflL-0004AA-HB for bug-guile@gnu.org; Sun, 27 Feb 2011 07:30:12 -0500 Original-Received: from colonialone.fsf.org ([140.186.70.51]:34685 helo=internal.in.savannah.gnu.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PtflL-00049w-FS for bug-guile@gnu.org; Sun, 27 Feb 2011 07:30:11 -0500 Original-Received: from [10.1.0.103] (helo=frontend.in.savannah.gnu.org) by internal.in.savannah.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PtflH-0006xr-SV; Sun, 27 Feb 2011 12:30:08 +0000 Original-Received: from www-data by frontend.in.savannah.gnu.org with local (Exim 4.72) (envelope-from ) id 1Ptfot-0002rI-Ch; Sun, 27 Feb 2011 12:33:53 +0000 X-PHP-Originating-Script: 0:sendmail.php X-Savane-Server: savannah.gnu.org:443 [10.1.0.103] X-Savane-Project: guile X-Savane-Tracker: bugs X-Savane-Item-ID: 31472 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Epiphany/2.30.2 X-Apparently-From: 90.164.198.39 (Savane authenticated user wingo) In-Reply-To: <20101026-224227.sv12227.22452@savannah.gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.51 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5237 Archived-At: Follow-up Comment #1, bug #31472 (project guile): Hi Andreas, I have thought about this one a fair amount this weekend. The issues are twofold. One, as you note, the modules are getting resolved wrongly -- the expansion makes the procedure scope "t" in the macro's module, not the expansion module. The question is, what should happen? According to all the hygiene folk I hear from, the (define t #(1 2 3)) shouldn't actually create a binding for "t" in any module. A simpler case is the following: (define-syntax define-x (syntax-rules () ((_) (define x 0)))) The issue is, what should happen when you (define-x) ? Should you later -- in the REPL, say -- be able to access a binding named "x" in the current module? Hygiene people say no. Hygiene people say that since the identifier "x" was introduced by the macro, it should be visible only within the macro --- and since it's not used elsewhere in the macro, effectively it's invisible. Though you can't really know its extent of course. And, in Guile, if we were to gensym a name for it -- a wild thing to think about doing, serializing a useless (define x_21234113132 0) into a .go file -- it would still take up "space" in the module (and the .go file), every time you (define-x) you would be adding useless, inaccessible bindings to your image. It doesn't seem like a great idea. So, unless I misunderstand the issues or am overlooking a solution, I think that Guile will continue to bind "t" in the expanding module, as indeed happens in this macro. The second problem thus "resolved", we need to make the procedure in the expansion scope its "t" according to the "t" it introduces. This only happens when expanding a toplevel sequence -- chi-top-sequence, in psyntax.scm. I have recently refactored that procedure to be able to know what bindings it introduces before going to expand the expressions. So your mission, should you choose to accept it, is to distructively mutate the toplevel ribcage before going in to expand the sub-expressions in chi-top-sequence. Good luck! Andy _______________________________________________________ Reply to this item at: _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/