From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luca Saiu Newsgroups: gmane.lisp.guile.bugs Subject: Syntax transformers and definition order Date: Fri, 26 Mar 2010 14:02:37 +0100 Message-ID: <4BACB06D.10707@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1269609001 14338 80.91.229.12 (26 Mar 2010 13:10:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 26 Mar 2010 13:10:01 +0000 (UTC) To: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Mar 26 14:09:55 2010 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 1Nv9IR-0003GS-5d for guile-bugs@m.gmane.org; Fri, 26 Mar 2010 14:09:55 +0100 Original-Received: from localhost ([127.0.0.1]:39070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv9IQ-0002Su-G1 for guile-bugs@m.gmane.org; Fri, 26 Mar 2010 09:09:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nv9FO-00018X-Pp for bug-guile@gnu.org; Fri, 26 Mar 2010 09:06:46 -0400 Original-Received: from [140.186.70.92] (port=42629 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv9FJ-00015K-HV for bug-guile@gnu.org; Fri, 26 Mar 2010 09:06:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nv9FH-0007xq-Hd for bug-guile@gnu.org; Fri, 26 Mar 2010 09:06:41 -0400 Original-Received: from mail.lipn.univ-paris13.fr ([194.254.163.24]:40642) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv9FH-0007xh-7E for bug-guile@gnu.org; Fri, 26 Mar 2010 09:06:39 -0400 Original-Received: from [10.10.0.234] (optimum.lipn.univ-paris13.fr [10.10.0.234]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: saiu@lipn.univ-paris13.fr) by mail.lipn.univ-paris13.fr (sendmail 8.9.3/8.9.2) with ESMTP id 994EF22E24 for ; Fri, 26 Mar 2010 14:06:38 +0100 (CET) User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20091109) X-Enigmail-Version: 0.95.0 OpenPGP: id=26C5D286; url=http://www-lipn.univ-paris13.fr/~saiu/lucasaiu.asc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:4532 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello guilers! Long time no see. I hope everything's all right. Guile rocks more and more. Thanks :-). I've found an incompatibility between 1.8 and 1.9 (tested with 1.9.8 and 1.9.9); if it's a documented change then sorry for the noise, I may just have missed it. Here's a distilled test case: ;;; Define a function calling a macro which is not yet defined: (define (go) (display (m 42))) ;;; Define the macro: (define-macro (m form) `(list ,form)) ;;; Call the function: (go) The code above does the right thing in 1.8, but 1.9 fails with ERROR: In procedure vm-debug-engine: ERROR: Wrong type to apply: # , either with or without the VM. I guess that when 1.9 parses the definition of go it assumes that the as-yet-unknown operator m will be a closure, and the assumption is not rectified later. I agree that what I wrote above is bad style, even if something very similar occurred in real code of mine, and the thing does indeed feel "Schemey". Of course if I move the definition of m before the definition of go then everything works also with 1.9. Just for completeness (I think it's not surprising, particularly for you who know the implementation), there isn't any such problem if go becomes a macro containing a *quoted* call of a macro which is not defined yet - -- this case is much more important in practice, as it's needed to define mutually-recursive macros: (define-macro (m1 form) (if (zero? (random 10)) form `(cons 1 (m2 ,form)))) (define-macro (m2 form) (if (zero? (random 10)) form `(cons 2 (m1 ,form)))) (define (go) (display (m1 42))) (go) This second snippet works fine also in 1.9. Best regards, - -- Luca Saiu http://www-lipn.univ-paris13.fr/~saiu GNU epsilon: http://www.gnu.org/software/epsilon Marionnet: http://www.marionnet.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkussG0ACgkQvzOavibF0oahEQCdGIY1kogi20FBYXadw/9yDlqR +MQAn3k5Wrspw8aGEdTncTcwwIPVyoUo =6lNC -----END PGP SIGNATURE-----