unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jean Abou Samra <jean@abou-samra.fr>
To: Mortimer Cladwell <mbcladwell@gmail.com>
Cc: guile-user@gnu.org, tomas@tuxteam.de
Subject: Re: Re: intern a top level variable
Date: Sun, 20 Aug 2023 15:56:15 +0200	[thread overview]
Message-ID: <c86e8dfc2d23a2183e30856b1ff2f163f9a98cee.camel@abou-samra.fr> (raw)
In-Reply-To: <CAOcxjM7j+Jo5NP_ZNvmXcVo92_QvGNa8RYv=CLuX8e7Bq94EhQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

Le mercredi 16 août 2023 à 15:17 -0400, Mortimer Cladwell a écrit :
> I would like to define a variable within a method but make it available to the
> entire module - globally. [...]
> So yes I will need to read more about interning.


OK, so the reason we were all confused is that "interning" is an unrelated
concept that has absolutely nothing to do with what you were looking for here.

Symbol interning is what makes this true:

(eq? 'foobar 'foobar)

Namely, it's the fact that whenever a symbol is created, if there is already
another symbol with the same name, that symbol object is reused.

It's not the same as defining variables. A symbol is not a variable, just the
name for a variable. Interning applies to symbols, which also happen to be the
objects used to name variables, but creating a symbol does not create a
variable, just like when I say "John is an English name", it doesn't make
someone named John appear in the room :)


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      parent reply	other threads:[~2023-08-20 13:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 14:55 Re: intern a top level variable Mortimer Cladwell
2023-08-16 16:13 ` Jean Abou Samra
2023-08-16 17:58   ` tomas
2023-08-16 19:17   ` Mortimer Cladwell
2023-08-16 20:35     ` Taylan Kammer
2023-08-17  6:07       ` Mortimer Cladwell
2023-08-20 13:56     ` Jean Abou Samra [this message]

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=c86e8dfc2d23a2183e30856b1ff2f163f9a98cee.camel@abou-samra.fr \
    --to=jean@abou-samra.fr \
    --cc=guile-user@gnu.org \
    --cc=mbcladwell@gmail.com \
    --cc=tomas@tuxteam.de \
    /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).