unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Subject: Re: defined? in module
Date: Fri, 17 Jul 2009 16:54:56 +0200	[thread overview]
Message-ID: <87hbxb9x6n.fsf@gnu.org> (raw)
In-Reply-To: h2q96l$d3m$1@ger.gmane.org

Hello Daniel,

I realized this question was left unanswered.

Daniel Kraft <d@domob.eu> writes:

> I'm trying to check if a given name is bound within some module.  It
> seems (from the documentation) that module objects are considered
> environments; but this does not work:
>
> scheme@(guile-user)> (defined? 'abc (current-module))

You want to use `module-defined?':

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (module-defined? (current-module) '+)
#t
--8<---------------cut here---------------end--------------->8---

The second argument to `defined?' is probably only valid in the context
of the evaluator:

--8<---------------cut here---------------start------------->8---
guile> (version)
$1 = "1.8.6"
guile> (defined? '+ (the-environment))
$2 = #t
guile> (let ((x 2))
         (defined? 'x (the-environment)))
$3 = #t
--8<---------------cut here---------------end--------------->8---

Maybe `defined?' should be changed in 1.9 to accept a module as its
second argument?

Thanks,
Ludo'.





  reply	other threads:[~2009-07-17 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-05 13:18 defined? in module Daniel Kraft
2009-07-17 14:54 ` Ludovic Courtès [this message]
2009-07-24 12:05   ` Andy Wingo

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=87hbxb9x6n.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-user@gnu.org \
    /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).