mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Deprecate passing a non-zero size to make-module
* module/ice-9/boot-9.scm (make-module): Issue a deprecation warning if users pass a non-zero size. (nested-define-module!, make-modules-in, beautify-user-module!) (resolve-interface, make-autoload-interface, %cond-expand-table): * module/ice-9/popen.scm (port/pid-table): * module/ice-9/session.scm (make-fold-modules): * module/language/ecmascript/function.scm (*program-wrappers*): * module/scripts/api-diff.scm (read-api-alist-file): * module/srfi/srfi-10.scm (reader-ctors): Update callers. Also remove some make-hash-table sizes.
This commit is contained in:
parent
f62e19bd10
commit
cc7d394490
8 changed files with 29 additions and 27 deletions
|
@ -2001,25 +2001,27 @@ name extensions listed in %load-extensions."
|
||||||
|
|
||||||
;; make-module &opt size uses binder
|
;; make-module &opt size uses binder
|
||||||
;;
|
;;
|
||||||
(define* (make-module #:optional (size 31) (uses '()) (binder #f))
|
(define* (make-module #:optional (size 0) (uses '()) (binder #f))
|
||||||
"Create a new module, perhaps with a particular size of obarray,
|
"Create a new module, perhaps with a particular size of obarray,
|
||||||
initial uses list, or binding procedure."
|
initial uses list, or binding procedure."
|
||||||
(if (not (integer? size))
|
(unless (integer? size)
|
||||||
(error "Illegal size to make-module." size))
|
(error "Illegal size to make-module." size))
|
||||||
(if (not (and (list? uses)
|
(unless (zero? size)
|
||||||
(and-map module? uses)))
|
(issue-deprecation-warning
|
||||||
(error "Incorrect use list." uses))
|
"Passing a non-zero size argument to `make-module' is deprecated. "
|
||||||
(if (and binder (not (procedure? binder)))
|
"Omit the argument or pass zero instead."))
|
||||||
(error
|
(unless (and (list? uses) (and-map module? uses))
|
||||||
"Lazy-binder expected to be a procedure or #f." binder))
|
(error "Incorrect use list." uses))
|
||||||
|
(when (and binder (not (procedure? binder)))
|
||||||
|
(error "Lazy-binder expected to be a procedure or #f." binder))
|
||||||
|
|
||||||
(module-constructor (make-hash-table size)
|
(module-constructor (make-hash-table size)
|
||||||
uses binder #f macroexpand
|
uses binder #f macroexpand
|
||||||
#f #f #f
|
#f #f #f
|
||||||
(make-hash-table)
|
(make-hash-table)
|
||||||
'()
|
'()
|
||||||
(make-weak-key-hash-table 31) #f
|
(make-weak-key-hash-table) #f
|
||||||
(make-hash-table 7) #f #f #f 0))
|
(make-hash-table) #f #f #f 0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2506,7 +2508,7 @@ interfaces are added to the inports list."
|
||||||
(if (null? tail)
|
(if (null? tail)
|
||||||
(module-define-submodule! cur head module)
|
(module-define-submodule! cur head module)
|
||||||
(let ((cur (or (module-ref-submodule cur head)
|
(let ((cur (or (module-ref-submodule cur head)
|
||||||
(let ((m (make-module 31)))
|
(let ((m (make-module)))
|
||||||
(set-module-kind! m 'directory)
|
(set-module-kind! m 'directory)
|
||||||
(set-module-name! m (append (module-name cur)
|
(set-module-name! m (append (module-name cur)
|
||||||
(list head)))
|
(list head)))
|
||||||
|
@ -2651,7 +2653,7 @@ deterministic."
|
||||||
|
|
||||||
(define (make-modules-in module name)
|
(define (make-modules-in module name)
|
||||||
(or (nested-ref-module module name)
|
(or (nested-ref-module module name)
|
||||||
(let ((m (make-module 31)))
|
(let ((m (make-module)))
|
||||||
(set-module-kind! m 'directory)
|
(set-module-kind! m 'directory)
|
||||||
(set-module-name! m (append (module-name module) name))
|
(set-module-name! m (append (module-name module) name))
|
||||||
(nested-define-module! module name m)
|
(nested-define-module! module name m)
|
||||||
|
@ -2663,7 +2665,7 @@ deterministic."
|
||||||
(let ((interface (module-public-interface module)))
|
(let ((interface (module-public-interface module)))
|
||||||
(if (or (not interface)
|
(if (or (not interface)
|
||||||
(eq? interface module))
|
(eq? interface module))
|
||||||
(let ((interface (make-module 31)))
|
(let ((interface (make-module)))
|
||||||
(set-module-name! interface (module-name module))
|
(set-module-name! interface (module-name module))
|
||||||
(set-module-version! interface (module-version module))
|
(set-module-version! interface (module-version module))
|
||||||
(set-module-kind! interface 'interface)
|
(set-module-kind! interface 'interface)
|
||||||
|
@ -2811,7 +2813,7 @@ error if selected binding does not exist in the used module."
|
||||||
public-i
|
public-i
|
||||||
(let ((selection (or select (module-map (lambda (sym var) sym)
|
(let ((selection (or select (module-map (lambda (sym var) sym)
|
||||||
public-i)))
|
public-i)))
|
||||||
(custom-i (make-module 31)))
|
(custom-i (make-module)))
|
||||||
(set-module-kind! custom-i 'custom-interface)
|
(set-module-kind! custom-i 'custom-interface)
|
||||||
(set-module-name! custom-i name)
|
(set-module-name! custom-i name)
|
||||||
;; Check that we are not hiding bindings which don't exist
|
;; Check that we are not hiding bindings which don't exist
|
||||||
|
@ -2950,7 +2952,7 @@ error if selected binding does not exist in the used module."
|
||||||
(module-local-variable i sym)))
|
(module-local-variable i sym)))
|
||||||
#:warning "Failed to autoload ~a in ~a:\n" sym name))))
|
#:warning "Failed to autoload ~a in ~a:\n" sym name))))
|
||||||
(module-constructor (make-hash-table 0) '() b #f #f name 'autoload #f
|
(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) '() (make-weak-value-hash-table) #f
|
||||||
(make-hash-table 0) #f #f #f 0)))
|
(make-hash-table 0) #f #f #f 0)))
|
||||||
|
|
||||||
(define (module-autoload! module . args)
|
(define (module-autoload! module . args)
|
||||||
|
@ -3581,7 +3583,7 @@ but it fails to load."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(define duplicate-handlers
|
(define duplicate-handlers
|
||||||
(let ((m (make-module 7)))
|
(let ((m (make-module)))
|
||||||
|
|
||||||
(define (check module name int1 val1 int2 val2 var val)
|
(define (check module name int1 val1 int2 val2 var val)
|
||||||
(scm-error 'misc-error
|
(scm-error 'misc-error
|
||||||
|
@ -3940,7 +3942,7 @@ when none is available, reading FILE-NAME with READER."
|
||||||
|
|
||||||
;; This table maps module public interfaces to the list of features.
|
;; This table maps module public interfaces to the list of features.
|
||||||
;;
|
;;
|
||||||
(define %cond-expand-table (make-hash-table 31))
|
(define %cond-expand-table (make-hash-table))
|
||||||
|
|
||||||
;; Add one or more features to the `cond-expand' feature list of the
|
;; Add one or more features to the `cond-expand' feature list of the
|
||||||
;; module `module'.
|
;; module `module'.
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
;; a weak hash-table to store the process ids.
|
;; a weak hash-table to store the process ids.
|
||||||
;; XXX use of this table is deprecated. It is no longer used here, and
|
;; XXX use of this table is deprecated. It is no longer used here, and
|
||||||
;; is populated for backward compatibility only (since it is exported).
|
;; is populated for backward compatibility only (since it is exported).
|
||||||
(define port/pid-table (make-weak-key-hash-table 31))
|
(define port/pid-table (make-weak-key-hash-table))
|
||||||
(define port/pid-table-mutex (make-mutex))
|
(define port/pid-table-mutex (make-mutex))
|
||||||
|
|
||||||
(define (open-pipe* mode command . args)
|
(define (open-pipe* mode command . args)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
;;;; Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
|
;;;; Copyright (C) 2000, 2001, 2006, 2019 Free Software Foundation, Inc.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; This library is free software; you can redistribute it and/or
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
;;;; modify it under the terms of the GNU Lesser General Public
|
;;;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
;;;; Safe subset of R5RS bindings
|
;;;; Safe subset of R5RS bindings
|
||||||
|
|
||||||
(define-module (ice-9 safe)
|
(define-module (ice-9 safe)
|
||||||
:export (safe-environment make-safe-module))
|
#:export (safe-environment make-safe-module))
|
||||||
|
|
||||||
(define safe-r5rs-interface (resolve-interface '(ice-9 safe-r5rs)))
|
(define safe-r5rs-interface (resolve-interface '(ice-9 safe-r5rs)))
|
||||||
|
|
||||||
|
@ -31,4 +31,4 @@
|
||||||
safe-r5rs-interface)
|
safe-r5rs-interface)
|
||||||
|
|
||||||
(define (make-safe-module)
|
(define (make-safe-module)
|
||||||
(make-module 1021 (list safe-r5rs-interface)))
|
(make-module 0 (list safe-r5rs-interface)))
|
||||||
|
|
|
@ -392,7 +392,7 @@ The forest traversed is the image of the forest generated by root
|
||||||
modules returned by INIT-THUNK and the generator TRAVERSE.
|
modules returned by INIT-THUNK and the generator TRAVERSE.
|
||||||
It is an image under the mapping EXTRACT."
|
It is an image under the mapping EXTRACT."
|
||||||
(lambda (fold-module init)
|
(lambda (fold-module init)
|
||||||
(let* ((table (make-hash-table 31))
|
(let* ((table (make-hash-table))
|
||||||
(first? (lambda (obj)
|
(first? (lambda (obj)
|
||||||
(let* ((handle (hash-create-handle! table obj #t))
|
(let* ((handle (hash-create-handle! table obj #t))
|
||||||
(first? (cdr handle)))
|
(first? (cdr handle)))
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
(define-class <js-program-wrapper> (<js-object>))
|
(define-class <js-program-wrapper> (<js-object>))
|
||||||
|
|
||||||
(define *program-wrappers* (make-doubly-weak-hash-table 31))
|
(define *program-wrappers* (make-doubly-weak-hash-table))
|
||||||
|
|
||||||
(define *function-prototype* (make <js-object> #:class "Function"
|
(define *function-prototype* (make <js-object> #:class "Function"
|
||||||
#:value (lambda args *undefined*)))
|
#:value (lambda args *undefined*)))
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
(library (rnrs eval (6))
|
(library (rnrs eval (6))
|
||||||
(export eval environment)
|
(export eval environment)
|
||||||
(import (only (guile) eval
|
(import (only (guile) eval
|
||||||
make-module
|
make-module
|
||||||
module-uses
|
module-uses
|
||||||
beautify-user-module!
|
beautify-user-module!
|
||||||
set-module-uses!)
|
set-module-uses!)
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
(meta (assq-ref alist 'meta))
|
(meta (assq-ref alist 'meta))
|
||||||
(interface (assq-ref alist 'interface)))
|
(interface (assq-ref alist 'interface)))
|
||||||
(put interface 'meta meta)
|
(put interface 'meta meta)
|
||||||
(put interface 'groups (let ((ht (make-hash-table 31)))
|
(put interface 'groups (let ((ht (make-hash-table)))
|
||||||
(for-each (lambda (group)
|
(for-each (lambda (group)
|
||||||
(hashq-set! ht group '()))
|
(hashq-set! ht group '()))
|
||||||
(assq-ref meta 'groups))
|
(assq-ref meta 'groups))
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
;; This hash table stores the association between comma-hash tags and
|
;; This hash table stores the association between comma-hash tags and
|
||||||
;; the corresponding constructor procedures.
|
;; the corresponding constructor procedures.
|
||||||
;;
|
;;
|
||||||
(define reader-ctors (make-hash-table 31))
|
(define reader-ctors (make-hash-table))
|
||||||
|
|
||||||
;; This procedure installs the procedure @var{proc} as the constructor
|
;; This procedure installs the procedure @var{proc} as the constructor
|
||||||
;; for the comma-hash tag @var{symbol}.
|
;; for the comma-hash tag @var{symbol}.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue