From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.user Subject: Re: problems with syntax-case and with-syntax Date: Mon, 28 Aug 2017 12:38:32 +0100 Message-ID: <20170828123832.57798634@bother.homenet> References: <87lgm4il3u.fsf@netris.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1503920356 18199 195.159.176.226 (28 Aug 2017 11:39:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 Aug 2017 11:39:16 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Aug 28 13:39:10 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmINo-0004Kg-1U for guile-user@m.gmane.org; Mon, 28 Aug 2017 13:39:08 +0200 Original-Received: from localhost ([::1]:39226 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmINu-0002Z8-Va for guile-user@m.gmane.org; Mon, 28 Aug 2017 07:39:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmINM-0002Xs-6W for guile-user@gnu.org; Mon, 28 Aug 2017 07:38:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmINJ-00017K-2P for guile-user@gnu.org; Mon, 28 Aug 2017 07:38:40 -0400 Original-Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:33770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dmINI-00016b-SU for guile-user@gnu.org; Mon, 28 Aug 2017 07:38:37 -0400 Original-Received: by mail-wr0-x234.google.com with SMTP id k94so899229wrc.0 for ; Mon, 28 Aug 2017 04:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=si/xBHZoCRdD0QvRaQgirMJcacJV656izvhKNIqzme4=; b=d7T0UjcpD9/aS9xdD2WZPTJXhjp5l0kzQh78ypxL5n2fTMclJQFZcezPn7UymBaXgW 2YuynoXb0XYyCJBiAbO8XEIqZSvh/wM7yb8ukMwhncnK7PKHcaagVT5qGWQ+ilNr5moc hiw5BGxrfh174TYoHqru9nAMHzN7kVvo/2VmPLuqSmjH5D0apsHg71YiD/Z3Nyj8NRU7 I5ei6rE1B2+mGCnRTxsTvJNo20/KEQXaioJdbzN80Dx355bVmNkjI8WgrqEDIoIBrNUw 4FsyRhacbB7Nsr415WBn9DADxbrRSSxkwshU2t2xJHdUehXp+eXNVdC7HTOTtp8LH6wK dLrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=si/xBHZoCRdD0QvRaQgirMJcacJV656izvhKNIqzme4=; b=JiqscnD1xhgOCzW48DeRAHGkGr3tlho8vypPDpkdQqKpBPD68+oerAILHuBbJ8YbQc 4Tla6LaqwRj3L6VbiPHhccnuysIFy+zGniLAUNgs3wXSp2r5+mrUjnXLY7vCJlrxu91w NPEHayv4IONu0fq1N02cZAcIVy7X69ZAJis7KDvGCD1S/07X3y6dBJow1nuOZmh0Eyc0 u25n63qkN+D7xAddsWFwy5gwBvt6JqNlZ9nc2Py8W79YO1XxB/WX8cvKRzD4DB/mVi6C 1G/HTGh2O7Lvd6S6IrvQWh+S2YySCfdQOES3yK/mi8xtZ1UUABzzyoySAOM4BKj0nrxX indQ== X-Gm-Message-State: AHYfb5g8Aa0SCM+knLhNWDhzQPiT4bdnN7OrRshByDDk8xNaSYWrOJnM fIThUDiPkCJKGZ6+ X-Received: by 10.223.166.20 with SMTP id k20mr203244wrc.35.1503920314284; Mon, 28 Aug 2017 04:38:34 -0700 (PDT) Original-Received: from bother.homenet ([95.146.110.53]) by smtp.gmail.com with ESMTPSA id j79sm162950wmd.20.2017.08.28.04.38.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 04:38:33 -0700 (PDT) Original-Received: from bother.homenet (localhost [IPv6:::1]) by bother.homenet (Postfix) with ESMTP id 61A1D262F6B for ; Mon, 28 Aug 2017 12:38:32 +0100 (BST) In-Reply-To: <87lgm4il3u.fsf@netris.org> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14074 Archived-At: On Sun, 27 Aug 2017 20:36:53 -0400 Mark H Weaver wrote: > Matt Wette writes: > > > Q1) The code below creates two macros. One called `define-foo' > > which generates a new identifier and then defines that to #t. The > > other, `define-foo/p', generates the same identifier (lexical > > issue?) and another identifier, then "calls" define-foo and then > > uses both identifiers in a `define'. When executed I get this > > error: > > > > scheme@(guile-user)> (define-foo/p abc) > > ;;; :2:0: warning: possibly unbound variable `wrap-abc' > > :2:0: :2:0: In procedure module-lookup: > > Unbound variable: wrap-abc > > > > What am I doing wrong here? > > The problem is that in Guile 2.2, whenever (define ...) is found > in the expanded code, where was introduced by a macro (i.e. not > passed as an explicit argument to the macro), Guile will rewrite the > into a new name based on the hash of the entire definition form. > > I don't know of any way to make this work without passing 'wrap-abc' > explicitly as an argument to the 'define-foo' macro. > > FWIW, I've always been opposed to these non-standard semantics, but > they were included in Guile 2.2 over my strenuous objections: > > https://lists.gnu.org/archive/html/guile-devel/2014-01/msg00061.html > https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00021.html > https://lists.gnu.org/archive/html/guile-devel/2011-11/msg00042.html How interesting. There seems very little uniformity in how the different schemes which I happen to have available deal with the issue of top level hygiene with nested macros. Given the example in paragraph 6.10.10 of the guile-2.2 manual, after the definitions of both 'foo' and 'bar' have both been made the following schemes evaluate '(foo)' as 37: guile-2.0, chicken; and the following evaluate it as 42: guile-2.2, chez, kawa. Chris