unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: Mortimer Cladwell <mbcladwell@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: intern a top level variable
Date: Wed, 16 Aug 2023 16:08:04 +0200	[thread overview]
Message-ID: <ZNzYRDM+bdLsKx2p@tuxteam.de> (raw)
In-Reply-To: <CAOcxjM4zekOeYmW6+oRxUET61dh0TBVJ4H4sc7cQt_OrrtVprA@mail.gmail.com>

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

On Wed, Aug 16, 2023 at 08:41:18AM -0400, Mortimer Cladwell wrote:
> Hi,
> How do I intern a top level variable?

You don't intern variables, you intern symbols (now I guess you
know that, but then: what are you trying to do?)

> looks like intern-symbol is
> deprecated? Is there a substitute? gensym does not seem to be it:

gensym evaluates to an already interned symbol:

  (symbol-interned? (gensym "foo"))
  => #t

> 
> scheme@(guile-user)> (gensym "abc")
> $11 = abc2652

... abc2652 would be an interned symbol here.

> scheme@(guile-user)> abc2652
> ;;; <unknown-location>: warning: possibly unbound variable `abc2652'
> ERROR: In procedure module-lookup: Unbound variable: abc2652

...but it is unbound (i.e. there is no value associated with it). For
this you would have to

  (define abc2652 "foo")

or something similar.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2023-08-16 14:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 12:41 intern a top level variable Mortimer Cladwell
2023-08-16 14:08 ` tomas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-16 14:55 Mortimer Cladwell
2023-08-16 16:13 ` Jean Abou Samra
2023-08-16 19:17   ` Mortimer Cladwell
2023-08-16 20:35     ` Taylan Kammer
2023-08-17  6:07       ` Mortimer Cladwell

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=ZNzYRDM+bdLsKx2p@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-user@gnu.org \
    --cc=mbcladwell@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).