Re: Autoloading of modules

Mikael Djurfeldt (mdj@nada.kth.se)
21 Dec 1996 15:42:51 +0100

Tim Pierce <twpierce@midway.uchicago.edu> writes:

> > For me, the autoloading occasionaly loads files that I don't want or
> > it loads files twice.
>
> Shouldn't autoloading work like `require' in this respect,
> and load only modules which have not already been loaded?

I think we should have a module autoloading mechanism in Guile which
works regardless how we have loaded the code (we might even load the
code by performing "eval-buffer" in Emacs).

Therefore I think it was a mistake to let `define-module' do
autoloading of the module being defined. Define should IMO partly be
the equivalent of `provide', making a note that Guile has seen this
module.

Then we should have another primitive which we use in *applications*
which want to use modules, e. g.:

(use-modules #/ice-9/slib #ice-9/threads ...)

Both :use-modules in `define-module' and `use-modules' should only
load those modules which have no notice of having been loaded.

I also would like to see a *function* autoloading mechanism in Guile,
perhaps an acro, mapping a function name to a module. Evaluating this
acro causes autoloading of the module and redefinition of the name to
the value defined on the new use-list.

Opinions?

/mdj