From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.devel Subject: Re: Exporting a nonexistent variable Date: Thu, 14 Nov 2024 11:27:52 +0100 Message-ID: References: <20241114104224.cZiN2D00o2o9iX101ZiPo0@xavier.telenet-ops.be> Reply-To: mikael@djurfeldt.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c5d3cd0626dce761" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17857"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Attila Lendvai , =?UTF-8?B?VG9tbWkgSMO2eW7DpGzDpG5tYWE=?= , "Jonas Hahnfeld via Developers list for Guile, the GNU extensibility library" To: Maxime Devos Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Nov 14 11:28:45 2024 Return-path: Envelope-to: guile-devel@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 1tBX5g-0004Pp-VI for guile-devel@m.gmane-mx.org; Thu, 14 Nov 2024 11:28:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBX5A-000327-KG; Thu, 14 Nov 2024 05:28:12 -0500 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 1tBX54-00031u-Qb for guile-devel@gnu.org; Thu, 14 Nov 2024 05:28:07 -0500 Original-Received: from mail-vk1-f177.google.com ([209.85.221.177]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBX52-0004pP-QH for guile-devel@gnu.org; Thu, 14 Nov 2024 05:28:06 -0500 Original-Received: by mail-vk1-f177.google.com with SMTP id 71dfb90a1353d-513d1a9552cso259823e0c.1 for ; Thu, 14 Nov 2024 02:28:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731580083; x=1732184883; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fRdZnsVuJq7Snxx5q82XVi/GTQG/GwLWhA6frSY6sFk=; b=V+UVekA7Dvx7JOQETbC2VyLtK+sqfTf76O+gzh3h3KhVbCr1jWwvi0d2+GMzYnqgia p6we/EEnaWNfveVz/EZrnFMbfsN3L0WoPkSdtyoifLeIPFZUU+89f6nz45AbDztKPMMq aXK/sWRqUwdIHDWB/UlZF9A9vnHVHNBCvpg1BZD20HG6RdwwLv0JcK1pqSQMhJP052mQ IAF6ong4oR81O4LLeaoP4Z3mdTiD5qMxLj8mVVCarzzzTCX26F+XgV4X3qLDBX2BEiw+ JtG19mAtrMCQBqMB1mNcxfQMpiT1f3PTnZ2K95lptvfv0Fx+7pnrUg9fQA9H4pTDwtbw EXzQ== X-Forwarded-Encrypted: i=1; AJvYcCVt+AXRnbm05LTAUXJ0eU1gWvK6iOOWW6Rpv1aYCJruOpn28ueO19D11DyLjyOZAeTm2bn5Dz1HbN2CQg==@gnu.org X-Gm-Message-State: AOJu0YxVgIjwx5BixR1cvy6Wa9kXSInV+TF8hONFAQmgFHQ3lOknVoAO /Kh4VEFOmrs81KP721SkQKYXM/ESVJOMgYwCAs+kGaFi6mGHrdxxyxH8rvPo3gICcaLGXWue3E2 CMCLcZl5y4x7I1uyWElS+zS4X6j8= X-Google-Smtp-Source: AGHT+IE8UFIxJfGKAmXKhzVS76e8EJyAxLMlNsWCwGIm68HAG8aHPlvhjFzZOQyNgIV90Ac8mPICrk4BxhMxuW++Og8= X-Received: by 2002:a05:6122:54a:b0:50d:3ec1:1534 with SMTP id 71dfb90a1353d-51401e8d43fmr24855059e0c.7.1731580083423; Thu, 14 Nov 2024 02:28:03 -0800 (PST) In-Reply-To: <20241114104224.cZiN2D00o2o9iX101ZiPo0@xavier.telenet-ops.be> Received-SPF: pass client-ip=209.85.221.177; envelope-from=mdjurfeldt@gmail.com; helo=mail-vk1-f177.google.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.738, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22775 Archived-At: --000000000000c5d3cd0626dce761 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I think the wording in the Guile manual is unfortunate. What RnRS says is that an identifier which is bound to a location is a variable. What the Guile manual is then discussing is our implementation details of this, where "bound" is used in a different sense than in RnRS. Den tors 14 nov. 2024 10:42Maxime Devos via Developers list for Guile, the GNU extensibility library skrev: > (My current e-mail client keeps corrupting guile-devel@gnu.org and > refuses access to the contact list, please ignore wrong address) > > > > >there are various use-cases where one wants to export a symbol [sic] fro= m > a module without binding [sic] any value to it in the module where it is > being exported from. > > > > Symbol -> variable, without binding any value -> without defining it to > some value, see > https://www.gnu.org/software/guile/manual/html_node/Variables.html. > Definedness and boundness are not the same thing. > > (It=E2=80=99s annoying that after the introduction where it talks about > definedness / boundness distinction, it gets things wrong again in the > first procedure `make-undefined-variable` and later `variable-bound?=E2= =80=99.) > > > > What use cases would this be? > > > > All I can think of is: > > > > >(define-module (a) #:export (b) (=3D>)) > > >(define b) > > >(define-syntax =3D> [something that makes compile-time error about this > needing a syntax-parameterize) > > > > In the first case, the variable =E2=80=98b=E2=80=99 is =E2=80=98undefined= =E2=80=99. But it is still bound: > an undefined variable is bound the symbol =E2=80=98b=E2=80=99 In the modu= le =E2=80=98a=E2=80=99. In the > second case, a variable with the name =E2=80=98=3D>=E2=80=99 is defined (= and has the status > of a macro), but only as a placeholder and except for error messages, it > might as well have been undefined instead. > > > > Neither of these is the situation in the original code, where the symbol > wasn=E2=80=99t bound to any variable =E2=80=93 no corresponding variable = exists, whether > defined or undefined (unless the =E2=80=98export=E2=80=99 implicitly crea= tes variables, but > that=E2=80=99s rather implicit and undocumented). And I don=E2=80=99t see= any use case for > that. > > > > Would be interesting to investigate what RnRS has to say about the > situation. > > > > > WARNING: (guile-user): `myproc' imported from both (mod1) and (mod2) > > > > >this^ is key, never ignore such warnings! i'd go as far as to suggest > that this warning should be turned into an error. that would force the > author to fix his package definitions to explicitly resolve such collisio= ns. > > > > Unless =E2=80=98myproc=E2=80=99 isn=E2=80=99t used (and it=E2=80=99s a wh= ole module being compiled at > once, not a REPL situation), then the import conflict wouldn=E2=80=99t ma= tter. > Could use a somewhat subtler approach. > > > > Best regards, > > Maxime Devos > --000000000000c5d3cd0626dce761 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think the wording in the Guile manual is unfortunate.
What RnRS says is that an ident= ifier which is bound to a location is a variable.
What the Guile manual is then discussing is our i= mplementation details of this, where "bound" is used in a differe= nt sense than in RnRS.

Den tors 14 nov. 2024 10:42Maxime Devos via D= evelopers list for Guile, the GNU extensibility library <guile-devel@gnu.org> skrev:

(My current e-mail client = keeps corrupting guile-devel@gnu.org and refuses access to the contact= list, please ignore wrong address)

=C2=A0

>there are various use-cases where one want= s to export a symbol [sic] from a module without binding [sic] any value to= it in the module where it is being exported from.

=

=C2=A0

=

Symbol -> variable, without = binding any value -> without defining it to some value,=C2=A0 see https://www.gnu.org/software/guile/manua= l/html_node/Variables.html. Definedness and boundness are not the same = thing.

= (It=E2=80=99s annoying that after the introduction where it talks about def= inedness / boundness distinction, it gets things wrong again in the first p= rocedure `make-undefined-variable` and later `variable-bound?=E2=80=99.)

= =C2=A0

What us= e cases would this be?

=C2=A0

All I can think of is:

=C2=A0

>(define-module (a) #:export (b) (=3D>= ;))

>= ;(define b)

>(define-syntax =3D> [something that makes compile-time error ab= out this needing a syntax-parameterize)

=C2=A0

In the first case, the variable =E2=80=98b= =E2=80=99 is =E2=80=98undefined=E2=80=99. But it is still bound: an undefin= ed variable is bound the symbol =E2=80=98b=E2=80=99 In the module =E2=80=98= a=E2=80=99. In the second case, a variable with the name =E2=80=98=3D>= =E2=80=99 is defined (and has the status of a macro), but only as a placeho= lder and except for error messages, it might as well have been undefined in= stead.

= =C2=A0

= Neither of these is the situation in the original code, where the symbol wa= sn=E2=80=99t bound to any variable =E2=80=93 no corresponding variable exis= ts, whether defined or undefined (unless the =E2=80=98export=E2=80=99 impli= citly creates variables, but that=E2=80=99s rather implicit and undocumente= d). And I don=E2=80=99t see any use case for that.

=

=C2=A0

=

Would be interesting to investi= gate what RnRS has to say about the situation.

=C2=A0

> WARNING: (guile-user): `myproc= ' imported from both (mod1) and (mod2)

=C2=A0

>this^ is key, never ignore such war= nings! i'd go as far as to suggest that this warning should be turned i= nto an error. that would force the author to fix his package definitions to= explicitly resolve such collisions.

=C2=A0

Unless =E2=80=98myproc=E2=80=99 isn=E2=80=99t= used (and it=E2=80=99s a whole module being compiled at once, not a REPL s= ituation), then the import conflict wouldn=E2=80=99t matter. Could use a so= mewhat subtler approach.

=C2=A0

Best regards,

Maxime Devos

<= /blockquote>
--000000000000c5d3cd0626dce761--