From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Julian Graham Newsgroups: gmane.lisp.guile.user Subject: bindings for free identifiers in (ice-9 syncase) Date: Thu, 19 Mar 2009 11:16:12 -0400 Message-ID: <2bc5f8210903190816y1ac88329td55765faeb081672@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1237478241 10824 80.91.229.12 (19 Mar 2009 15:57:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Mar 2009 15:57:21 +0000 (UTC) To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 19 16:58:33 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 1LkKdD-0003nQ-8o for guile-user@m.gmane.org; Thu, 19 Mar 2009 16:58:07 +0100 Original-Received: from localhost ([127.0.0.1]:55735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkKbq-0000nO-PJ for guile-user@m.gmane.org; Thu, 19 Mar 2009 11:56:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LkJyj-0003Dm-VK for guile-user@gnu.org; Thu, 19 Mar 2009 11:16:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LkJyj-0003DM-58 for guile-user@gnu.org; Thu, 19 Mar 2009 11:16:17 -0400 Original-Received: from [199.232.76.173] (port=48941 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkJyi-0003DB-QT for guile-user@gnu.org; Thu, 19 Mar 2009 11:16:16 -0400 Original-Received: from yx-out-1718.google.com ([74.125.44.153]:47373) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LkJyi-000747-Fr for guile-user@gnu.org; Thu, 19 Mar 2009 11:16:16 -0400 Original-Received: by yx-out-1718.google.com with SMTP id 3so394250yxi.66 for ; Thu, 19 Mar 2009 08:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=DXMJKopncjdYenwvj6npIxg6vjhHjy95NXAOcnSyqK0=; b=UCIrZjGgJ9fyCioKyTisKtCsU21l+hRRsXaGxCG4oOGBWpmePeIBgH16+QgqF/oecx 5BSvnsPg5yYGThzSSkGwj08XGoQuAGHNbrxh8KIMLsZskwWsZ240x+k5uNPPnBvtsRhk K+HEZ4o567uupI/r5obYu72SLjLuU+q/ynVmY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=irBGXQDl/OSLCO4yEEpg49QiujpSMeG/WsiLL06BZPt0vOgCeY0Z/rnPKywSwX02F8 EWk8fXP7huf3pO/OKIhk+El8AUfbzC1uPKUXw6P/Avtwash+9trAKsWkEgmp8r5rIh/c 6d04E8SXggnRd4FKx5noVRQf0mrqFt2Im+bNs= Original-Received: by 10.100.239.11 with SMTP id m11mr2893238anh.22.1237475772137; Thu, 19 Mar 2009 08:16:12 -0700 (PDT) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:7173 Archived-At: Hi Guilers, Alright, I've been banging my head against this for several weeks now and only just had the time to sit down and research this: If you use a symbol in an `(ice-9 syncase)' macro definition that's bound in the lexical closure in which that definition lives, then that binding should be the one that gets used at transformation time. At least, that's how I interpret the following bit of R5RS: "If a macro transformer inserts a free reference to an identifier, the reference refers to the binding that was visible where the transformer was specified, regardless of any local bindings that may surround the use of the macro." ...but that's not what Guile seems to do. (I'm fiddling around in 1.9.0 HEAD, because the VM is awesome and because there are some already-committed syncase fixes that have been useful to me...) If you create the following module: (define (foo-module) #:use-module (ice-9 syncase) #:export-syntax (foo-macro)) (define (foo-function) (display "Hello, world!")) (define-syntax foo-macro (lambda (stx) (syntax-case stx () ((_) (syntax (foo-function)))))) ...and then import `(foo-module)' into the REPL or somewhere else, evaluating `(foo-macro)' throws an error because `foo-function' can't be found. What am I doing wrong? Regards, Julian