[Top][All Lists]

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

Re: Modules: first steps.

From: Marius Vollmer
Subject: Re: Modules: first steps.
Date: 21 Sep 2002 23:02:45 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Han-Wen Nienhuys <address@hidden> writes:

> address@hidden writes:
> > >  * It would be nice if the C smob example also touched on module use.
> > 
> > There is "examples/box-module".  Is that what you are looking for, or
> > something else?
> It would be nice if this was referred to in the documentation. I
> accidentally stumbled upon it yesterday.

I'll add it.

> > The reason that you version didn't work is that when
> > scm_c_resolve_module (and 'resolve-module') can't find the
> > requested module, it returns a fresh, empty one.  It is _totally_
> > empty, which means that things like 'use-modules' aren't
> > available.  Since you want to define a new module, you should use
> > scm_c_define_module.  It will do all the right things.
> OK. The difference wasn't clear to me at all, and I don't think the
> distinction is there in the doco.

I'd say it's suboptimal behavior of scm_c_resolve_module to construct
an empty, mostly useless module when it can't find the real one.  It
should probably just signal an error.

> This means that if I do
>           SCM mod = scm_c_define_module (...)
>           scm_set_current_module (mod)
>           scm_c_define ("foo", ... );
> then 'foo is defined in MOD?


Depending on how your code is structured, it might be cleaner to use
scm_c_module_define.  That avoids messing with the current module.

GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405

reply via email to

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