[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [guile/scwm] 2nd argument problem to scm_definedp()
From: |
Rob Browning |
Subject: |
Re: [guile/scwm] 2nd argument problem to scm_definedp() |
Date: |
Tue, 17 Sep 2002 11:00:27 -0500 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu) |
Marius Vollmer <address@hidden> writes:
> scm_definedp (load_path_sym,
> scm_top_level_env (
> scm_module_lookup_closure (scm_current_module ())));
>
> But I would not recommend using this. Better lobby us to include a
> real scm_c_module_defined_p function.
Why did we decide not to just have scm_module_lookup return SCM_BOOL_F
if the variable wasn't defined? That seems more flexible. I think
there was some reason, but I can't reecall it at the moment. i.e.
SCM
scm_module_lookup (SCM module, SCM sym)
#define FUNC_NAME "module-lookup"
{
SCM var;
SCM_VALIDATE_MODULE (1, module);
var = scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
return var;
}
#undef FUNC_NAME
alternately, if that's not OK, how about:
SCM
scm_module_symbol_defined_p (SCM module, SCM sym)
#define FUNC_NAME "module-symbol-defined?"
{
SCM var;
SCM_VALIDATE_MODULE (1, module);
var = scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
if (SCM_FALSEP (var))
return SCM_BOOL_F;
else
return SCM_BOOL_T;
}
#undef FUNC_NAME
Though this is wasteful in cases where you want to know if the value
is defined *and* use it if it is.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD
- Re: [guile/scwm] 2nd argument problem to scm_definedp(), (continued)
Re: [guile/scwm] 2nd argument problem to scm_definedp(), P Pareit, 2002/09/17
Re: [guile/scwm] 2nd argument problem to scm_definedp(), Rob Browning, 2002/09/16