+1998-12-02 Mikael Djurfeldt <mdj@barbara.nada.kth.se>
+
+ * boot-9.scm (process-define-module): Added new specifier
+ :autoload MODULENAME BINDINGS to the define-module form.
+ The autoload specifier tells the module system to load the module
+ MODULENAME at the first occasion that any variable with its name
+ among BINDINGS is referenced.
+ (make-autoload-interface): New procedure: Constructs a stand-in
+ for the public interface for the module to be autoloaded.
+
1998-12-01 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* boot-9.scm (*suppress-old-style-hook-warning*): Set this to #t
#f)))
(loop (cddr kws)
(cons interface reversed-interfaces)))))))
+ ((autoload)
+ (if (not (and (pair? (cdr kws)) (pair? (cddr kws))))
+ (error "unrecognized defmodule argument" kws))
+ (loop (cdddr kws)
+ (cons (make-autoload-interface module
+ (cadr kws)
+ (caddr kws))
+ reversed-interfaces)))
(else
(error "unrecognized defmodule argument" kws))))))
module))
+
+;;; {Autoload}
+
+(define (make-autoload-interface module name bindings)
+ (let ((b (lambda (a sym definep)
+ (and (memq sym bindings)
+ (let ((i (module-public-interface (resolve-module name))))
+ (if (not i)
+ (error "missing interface for module" name))
+ ;; Replace autoload-interface with interface
+ (set-car! (memq a (module-uses module)) i)
+ (module-local-variable i sym))))))
+ (module-constructor #() #f b #f #f name 'autoload)))
+
\f
;;; {Autoloading modules}
(lambda () (set-autoloaded! dir-hint name didit)))
didit))))
+\f
;;; Dynamic linking of modules
;; Initializing a module that is written in C is a two step process.