diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 6110ecf1f..05b6a194a 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -1551,6 +1551,7 @@ If there is no handler at all, Guile prints an error and then exits." ;; NOTE: The getter `module-eval-closure' is used in libguile/modules.c. ;; NOTE: The getter `module-transfomer' is defined libguile/modules.c. ;; NOTE: The getter `module-name' is defined later, due to boot reasons. + ;; NOTE: The getter `module-public-interface' is used in libguile/modules.c. ;; (define-record-type module (lambda (obj port) (%print-module obj port)) @@ -1567,7 +1568,8 @@ If there is no handler at all, Guile prints an error and then exits." (weak-observers #:no-setter) version submodules - submodule-binder))) + submodule-binder + public-interface))) ;; make-module &opt size uses binder @@ -1609,7 +1611,7 @@ If there is no handler at all, Guile prints an error and then exits." (make-hash-table %default-import-size) '() (make-weak-key-hash-table 31) #f - (make-hash-table 7) #f))) + (make-hash-table 7) #f #f))) ;; We can't pass this as an argument to module-constructor, ;; because we need it to close over a pointer to the module @@ -2218,11 +2220,6 @@ If there is no handler at all, Guile prints an error and then exits." ;;; better thought of as a root. ;;; -(define (module-public-interface m) - (let ((var (module-local-variable m '%module-public-interface))) - (and var (variable-ref var)))) -(define (set-module-public-interface! m i) - (module-define! m '%module-public-interface i)) (define (set-system-module! m s) (set-procedure-property! (module-eval-closure m) 'system-module s)) (define the-root-module (make-root-module)) @@ -2686,7 +2683,7 @@ If there is no handler at all, Guile prints an error and then exits." (module-local-variable i sym)))))) (module-constructor (make-hash-table 0) '() b #f #f name 'autoload #f (make-hash-table 0) '() (make-weak-value-hash-table 31) #f - (make-hash-table 0) #f))) + (make-hash-table 0) #f #f))) (define (module-autoload! module . args) "Have @var{module} automatically load the module named @var{name} when one diff --git a/module/ice-9/deprecated.scm b/module/ice-9/deprecated.scm index 15e245d1a..d55f20f89 100644 --- a/module/ice-9/deprecated.scm +++ b/module/ice-9/deprecated.scm @@ -327,3 +327,26 @@ (module-define-submodule! the-root-module '%app %app) (module-define-submodule! the-root-module 'app %app) (module-define-submodule! %app 'modules (resolve-module '() #f))) + +;; Allow code that poked %module-public-interface to keep on working. +;; +(set! module-public-interface + (let ((getter module-public-interface)) + (lambda (mod) + (or (getter mod) + (cond + ((and=> (module-local-variable mod '%module-public-interface) + variable-ref) + => (lambda (iface) + (issue-deprecation-warning +"Setting a module's public interface via munging %module-public-interface is +deprecated. Use set-module-public-interface! instead.") + (set-module-public-interface! mod iface) + iface)) + (else #f)))))) + +(set! set-module-public-interface! + (let ((setter set-module-public-interface!)) + (lambda (mod iface) + (setter mod iface) + (module-define! mod '%module-public-interface iface))))