From: Attila Lendvai <attila@lendvai.name>
To: "Tommi Höynälänmaa" <tommi.hoynalanmaa@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: Exporting a nonexistent variable
Date: Wed, 13 Nov 2024 22:22:58 +0000 [thread overview]
Message-ID: <PCTAO9kpLu6iWzkrN0s1TDIoIsNRkybpRvxxKQsoHZ3te6fSkmRTq-K2SzEPhgIuUXfVytmtRI0UtYXpdPzXH4NFcShEAX4wxFe2GH4CvBE=@lendvai.name> (raw)
In-Reply-To: <ff0a315c-44ce-8c95-fc4b-a326f301c741@gmail.com>
> I think Guile could report a warning if a nonexistent variable is
> exported as the cause of this kind of errors may be difficult to find in
> a large program.
you are exporting _symbols_ (unique identities) from modules, not variables (or bindings).
there are various use-cases where one wants to export a symbol from a module without binding any value to it in the module where it is being exported from.
> 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 collisions.
sidenote: any serious codebase should compile with zero warnings, otherwise people start to ignore such warnings, they accummulate, and then waste precious programmer attention in debugging sessions.
our (Common Lisp) team used to have a running joke that if a situation just doesn't make any sense, then it must be a package (module) issue: `foo` and `foo` may print the same, but can be different identities.
> Backtrace:
> In ice-9/boot-9.scm:
> 1762:12 4 (with-exception-handler _ _ #:unwind? _ # _)
> In unknown file:
> 3 (apply-smob/0 #<thunk 7f3e3cd10300>)
>
> In ice-9/boot-9.scm:
> 731:2 2 (call-with-prompt ("prompt") #<procedure 7f3e3cd22b00 …> …)
>
> In ice-9/eval.scm:
> 619:8 1 (_ #(#(#<directory (guile-user) 7f3e3cd13c80>)))
>
> In program.scm:
> 6:3 0 (main _)
>
> program.scm:6:3: In procedure main:
> Unbound variable: myproc
there are two `myproc` symbols at play here, and you're trying to dereference the one that has no value bound to. you've been warned prior to this.
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
You cannot wake up someone who is only pretending to be asleep.
— Indian proverb
next prev parent reply other threads:[~2024-11-13 22:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 12:26 Exporting a nonexistent variable Tommi Höynälänmaa
2024-11-04 20:43 ` Maxime Devos
2024-11-05 7:25 ` Tommi Höynälänmaa
2024-11-05 9:23 ` Maxime Devos
2024-11-05 9:26 ` Maxime Devos
2024-11-05 10:00 ` Tommi Höynälänmaa
2024-11-13 22:22 ` Attila Lendvai [this message]
2024-11-14 9:42 ` Maxime Devos via Developers list for Guile, the GNU extensibility library
2024-11-14 10:27 ` Mikael Djurfeldt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='PCTAO9kpLu6iWzkrN0s1TDIoIsNRkybpRvxxKQsoHZ3te6fSkmRTq-K2SzEPhgIuUXfVytmtRI0UtYXpdPzXH4NFcShEAX4wxFe2GH4CvBE=@lendvai.name' \
--to=attila@lendvai.name \
--cc=guile-devel@gnu.org \
--cc=tommi.hoynalanmaa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).