From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Timothy Sample Newsgroups: gmane.lisp.guile.user Subject: Re: Inconsistencies with free-identifier=? and bound-identifier=? Date: Thu, 27 Jul 2023 12:28:21 -0600 Message-ID: <87h6ppi4ze.fsf@ngyro.com> References: <008f724d79b871ce1d68121402bbcbcdd25ec270.camel@abou-samra.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15039"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: guile-user@gnu.org To: Jean Abou Samra Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Jul 27 20:33:51 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qP5o5-0003c9-9c for guile-user@m.gmane-mx.org; Thu, 27 Jul 2023 20:33:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qP5iz-0007ym-5S; Thu, 27 Jul 2023 14:28:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP5iv-0007yW-1j for guile-user@gnu.org; Thu, 27 Jul 2023 14:28:29 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qP5ir-0008Ai-1p for guile-user@gnu.org; Thu, 27 Jul 2023 14:28:27 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C9C3C5C04B8; Thu, 27 Jul 2023 14:28:23 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 27 Jul 2023 14:28:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ngyro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1690482503; x=1690568903; bh=u8z8XVhS+WMDBgyJi0dCqp7WIRz2An2T1SE OBfHp8/s=; b=JaB1R5VRshJ+T35LA8z4wBnRquVSxpezDNhIzYDWNdrY/07EPzo 0IptToyKVuVu6+7T8OsF5Z4uiFOxW4F52VKMv51RBN2aWZAvgEagyqt9poWYCJl1 SBbKm3JvJVdIFna7Gr4uWzQ9M6JKCbTDJMdkhFVp/5TGD/C2YliJjibogtN8ULtm lDpwRo9/y0vLTZgFI5rAEaqpaqWBj6swOjzkeOOreEb198c2OfhWvI8VYboYQIHU 9H+7MdTfhEHpoNQxVg5h4Occ+JnUcAwynkSicjHuORKB1R+VnGRthQk71qPjPiJG ZLfnjuqLIq5Hw0WnAOEGx5jMkUGIyvca3jw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1690482503; x=1690568903; bh=u8z8XVhS+WMDBgyJi0dCqp7WIRz2An2T1SE OBfHp8/s=; b=Ayo6s/npH2BNqj3H1C31bYVvn/6Nj2/4IrtWFM3nm5tuICjaKsE if9EBHUUaPp4RL+Q8Xig17dto6KenGnXJDbM9/JgJrAqj24XmfQpAem0Hr27CRgU I8XIVXmghGpZx4ds7FooVUUai09gI8fTbQG7z9iwvTUcCxB/2MEk7hpxJgbXedhs AwCy031Gwr8OKvOgnSVlyHFgYvnlJNqMWw2iZLgbZ+jcotg7IkSOq9e07PADZH+C pF3H2AgpShEVxcZXeWkCnk0BdGxrq6HrPqsz4Q7V8c5oBiaK9p6F/WOPvqSorwII MpOhdrF+Cfx5vxDiKHejSOWKwLjd61EhWZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrieeggdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufhfffgjkfgfgggtgfesthhqredttderjeenucfhrhhomhepvfhimhho thhhhicuufgrmhhplhgvuceoshgrmhhplhgvthesnhhghihrohdrtghomheqnecuggftrf grthhtvghrnhephfeghfeiteefffejgeevkeelkedugeevvdeuteffieefvdehvdehvddt gffggeeinecuffhomhgrihhnpehgihhtlhgrsgdrtghomhdpuhhtrghhrdgvughunecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgrmhhplhgv thesnhhghihrohdrtghomh X-ME-Proxy: Feedback-ID: i4721425c:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Jul 2023 14:28:23 -0400 (EDT) In-Reply-To: <008f724d79b871ce1d68121402bbcbcdd25ec270.camel@abou-samra.fr> (Jean Abou Samra's message of "Fri, 21 Jul 2023 02:20:03 +0200") Received-SPF: pass client-ip=66.111.4.27; envelope-from=samplet@ngyro.com; helo=out3-smtp.messagingengine.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URI_DOTEDU=1 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19106 Archived-At: Hi Jean, Jean Abou Samra writes: > Consider the following test program. > > (define-syntax foo-test > (lambda (sintax) > (let ((foo1 (let ((foo 'bar)) > (syntax foo))) > (foo2 (let ((foo 'bar)) > (syntax foo)))) > (display "free-identifier=3D? ") > (display (free-identifier=3D? foo1 foo2)) > (newline) > (display "bound-identifier=3D? ") > (display (bound-identifier=3D? foo1 foo2)) > (newline) > (with-syntax ((foo1 foo1) (foo2 foo2)) > (syntax > (let ((foo2 'not-shadowed)) > (let ((foo1 'shadowed)) > (display foo2) (newline)))))))) > (foo-test) FWIW, I tried this in my own pet expander, and got the following: free-identifier=3D? #f bound-identifier=3D? #f not-shadowed It=E2=80=99s a very simple expander that uses sets-of-scopes for hygiene. = As such, they are not =E2=80=98bound-identifier=3D?=E2=80=99 since they can be= distinguished by the two different scopes introduced by the different invocations of =E2=80=98let=E2=80=99. For =E2=80=98free-identifier=3D?=E2=80=99, they eac= h resolve to different bindings to the value =E2=80=98'bar=E2=80=99, so that=E2=80=99s a =E2=80=9Cno=E2=80= =9D. Ultimately, I don=E2=80=99t think you can ask =E2=80=9Cwho=E2=80=99s right?= =E2=80=9D These predicates answer questions about how a given expander distinguishes identifiers. If two expanders distinguish identifiers differently, they should give different answers! However, I do agree that =E2=80=98bound-identifier=3D?= =E2=80=99 should imply =E2=80=98free-identifier=3D?=E2=80=99, so I don=E2=80=99t know what= =E2=80=99s going on with Guile and Chez. (AIUI, their expanders are both based on psyntax, so I guess it makes sense that they are similar.) Also, Kawa is obviously wrong =E2= =80=93 =E2=80=98bound-identifier=3D?=E2=80=99 must imply =E2=80=9Cshadowed=E2=80= =9D. May I ask why you are exploring this? It=E2=80=99s quite arcane! You could try and get in touch with Marc Nieper-Wi=C3=9Fkirchen, the author SRFI 211 (Scheme Macro Libraries) and Unsyntax (https://gitlab.com/nieper/unsyntax). Both of those projects suggest a pretty thoroughgoing knowledge of Scheme macros. I think Marc also worked on getting =E2=80=98syntax-case=E2=80=99 into Chibi Scheme. Lastly, you should read section 3.1 of =E2=80=9CBinding as Sets of Scopes= =E2=80=9D: https://www-old.cs.utah.edu/plt/scope-sets/general-macros.html#%28part.= _.Identifier_.Comparisons_with_.Scope_.Sets%29 It shows that =E2=80=98bound-identifier=3D?=E2=80=99 gives false negatives = in both sets-of-scopes and marks-and-substitutions hygiene systems. (I didn=E2=80= =99t test that example or anything, but I thought it fit the theme of identifier predicate arcana pretty well.) -- Tim