This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: practical Guile module handling
Jost Boekemeier <jostobfe@linux.zrz.TU-Berlin.DE> writes:
<snip>
> In any case `scwm-module-loaded?' can be defined as:
> (define (scwm-module-loaded?) (environment-bound? module-environment <name>))
Great-- we'll switch to this!
> It is also interesting to note that some operations are valid only on
> opened modules while others work only on closed modules---for example
> you can't compile an opened module. In other words: A module has two
> states, `opened' and `closed'. These states are recorded (among other
> things) in module-environment.
>
> [Eval after load]
> > this infrastructure to implement an `eval-after-load' mechanism (that
> > evals the proc immediately if the module is already loaded, or once it
>
> Hmm. Mabe this can be implemented as hooks? That would be two hooks:
> eval-before-opened-hook and eval-after-opened-hook.
<snip>
You mean hooks on a per module basis, or a single global hook that gets
passed the name of the module (or the module environment, or whatever)
and must handle all modules? I think we need to be able to write:
(eval-after-load '(app scwm base) (lambda () ...))
Of course this could be done on top of global hooks, too.
<snip>
> > is loaded successfully). Finally, I add a `use-scwm-module' macro that
> > (in addition to assumming (app scwm) as a prefix to whatever module name
> > you give [obviously that part is not generally useful to guile]) ensures
> > that a failed module load doesn't prevent all the other modules from
> > loading.
>
> I don't have my new module code here but I think *-load-internal
> returns #f if a module could not be loaded. Only *-load throws an
> error (I don't think that `catch' is appropriate in this case).
I'm not sure what you mean here; perhaps you went to too low detail for
me. I want to make it possible that modules listed in one use-modules
expression can have the semantics of just loading those modules that can
be loaded. I'm not convinced that the current semantics don't make
sense, too, I just think that it's less frequently the case that I want
to load all or none of the modules I list. That functionality could be
renamed to atomic-use-modules or whatever.
Thanks,
Greg