1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 14:21:10 +02:00

* 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.
This commit is contained in:
Mikael Djurfeldt 1998-12-01 17:06:34 +00:00
parent 3b3085c692
commit 7122506062
2 changed files with 33 additions and 0 deletions

View file

@ -1,3 +1,13 @@
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

View file

@ -1989,9 +1989,31 @@
#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)))
;;; {Autoloading modules}
@ -2038,6 +2060,7 @@
(lambda () (set-autoloaded! dir-hint name didit)))
didit))))
;;; Dynamic linking of modules
;; Initializing a module that is written in C is a two step process.