[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defined? in module

From: Ludovic Courtès
Subject: Re: defined? in module
Date: Fri, 17 Jul 2009 16:54:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Hello Daniel,

I realized this question was left unanswered.

Daniel Kraft <address@hidden> 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) '+)
--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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]