diff options
author | Andy Wingo <wingo@pobox.com> | 2019-09-27 22:28:34 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-09-27 22:57:38 +0200 |
commit | cc7d394490bb1553e22f5238ce0e5d425ae660fa (patch) | |
tree | cb3964897185231903a9165fbcd2f3e4c9ef54d2 | |
parent | f62e19bd10f3380d46dc03dabeb1cf3b307b0e9c (diff) | |
download | guile-cc7d394490bb1553e22f5238ce0e5d425ae660fa.tar.gz |
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.
-rw-r--r-- | module/ice-9/boot-9.scm | 38 | ||||
-rw-r--r-- | module/ice-9/popen.scm | 2 | ||||
-rw-r--r-- | module/ice-9/safe.scm | 6 | ||||
-rw-r--r-- | module/ice-9/session.scm | 2 | ||||
-rw-r--r-- | module/language/ecmascript/function.scm | 2 | ||||
-rw-r--r-- | module/rnrs/eval.scm | 2 | ||||
-rw-r--r-- | module/scripts/api-diff.scm | 2 | ||||
-rw-r--r-- | module/srfi/srfi-10.scm | 2 |
8 files changed, 29 insertions, 27 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 05cddacf1..cbe8b5e39 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2001,25 +2001,27 @@ name extensions listed in %load-extensions." ;; 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, initial uses list, or binding procedure." - (if (not (integer? size)) - (error "Illegal size to make-module." size)) - (if (not (and (list? uses) - (and-map module? uses))) - (error "Incorrect use list." uses)) - (if (and binder (not (procedure? binder))) - (error - "Lazy-binder expected to be a procedure or #f." binder)) + (unless (integer? size) + (error "Illegal size to make-module." size)) + (unless (zero? size) + (issue-deprecation-warning + "Passing a non-zero size argument to `make-module' is deprecated. " + "Omit the argument or pass zero instead.")) + (unless (and (list? uses) (and-map module? uses)) + (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) uses binder #f macroexpand #f #f #f (make-hash-table) '() - (make-weak-key-hash-table 31) #f - (make-hash-table 7) #f #f #f 0)) + (make-weak-key-hash-table) #f + (make-hash-table) #f #f #f 0)) @@ -2506,7 +2508,7 @@ interfaces are added to the inports list." (if (null? tail) (module-define-submodule! cur head module) (let ((cur (or (module-ref-submodule cur head) - (let ((m (make-module 31))) + (let ((m (make-module))) (set-module-kind! m 'directory) (set-module-name! m (append (module-name cur) (list head))) @@ -2651,7 +2653,7 @@ deterministic." (define (make-modules-in module name) (or (nested-ref-module module name) - (let ((m (make-module 31))) + (let ((m (make-module))) (set-module-kind! m 'directory) (set-module-name! m (append (module-name module) name)) (nested-define-module! module name m) @@ -2663,7 +2665,7 @@ deterministic." (let ((interface (module-public-interface module))) (if (or (not interface) (eq? interface module)) - (let ((interface (make-module 31))) + (let ((interface (make-module))) (set-module-name! interface (module-name module)) (set-module-version! interface (module-version module)) (set-module-kind! interface 'interface) @@ -2811,7 +2813,7 @@ error if selected binding does not exist in the used module." public-i (let ((selection (or select (module-map (lambda (sym var) sym) public-i))) - (custom-i (make-module 31))) + (custom-i (make-module))) (set-module-kind! custom-i 'custom-interface) (set-module-name! custom-i name) ;; 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))) #:warning "Failed to autoload ~a in ~a:\n" sym name)))) (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))) (define (module-autoload! module . args) @@ -3581,7 +3583,7 @@ but it fails to load." ;; (define duplicate-handlers - (let ((m (make-module 7))) + (let ((m (make-module))) (define (check module name int1 val1 int2 val2 var val) (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. ;; -(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 ;; module `module'. diff --git a/module/ice-9/popen.scm b/module/ice-9/popen.scm index f9781c698..2afe45701 100644 --- a/module/ice-9/popen.scm +++ b/module/ice-9/popen.scm @@ -81,7 +81,7 @@ ;; a weak hash-table to store the process ids. ;; XXX use of this table is deprecated. It is no longer used here, and ;; 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 (open-pipe* mode command . args) diff --git a/module/ice-9/safe.scm b/module/ice-9/safe.scm index 1ce8f9ed9..035565efe 100644 --- a/module/ice-9/safe.scm +++ b/module/ice-9/safe.scm @@ -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 ;;;; modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ ;;;; Safe subset of R5RS bindings (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))) @@ -31,4 +31,4 @@ safe-r5rs-interface) (define (make-safe-module) - (make-module 1021 (list safe-r5rs-interface))) + (make-module 0 (list safe-r5rs-interface))) diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm index a6ab3ab75..63052e719 100644 --- a/module/ice-9/session.scm +++ b/module/ice-9/session.scm @@ -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. It is an image under the mapping EXTRACT." (lambda (fold-module init) - (let* ((table (make-hash-table 31)) + (let* ((table (make-hash-table)) (first? (lambda (obj) (let* ((handle (hash-create-handle! table obj #t)) (first? (cdr handle))) diff --git a/module/language/ecmascript/function.scm b/module/language/ecmascript/function.scm index 710c5cb1c..72edc4e61 100644 --- a/module/language/ecmascript/function.scm +++ b/module/language/ecmascript/function.scm @@ -26,7 +26,7 @@ (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" #:value (lambda args *undefined*))) diff --git a/module/rnrs/eval.scm b/module/rnrs/eval.scm index d58f87768..37a738bd9 100644 --- a/module/rnrs/eval.scm +++ b/module/rnrs/eval.scm @@ -20,7 +20,7 @@ (library (rnrs eval (6)) (export eval environment) (import (only (guile) eval - make-module + make-module module-uses beautify-user-module! set-module-uses!) diff --git a/module/scripts/api-diff.scm b/module/scripts/api-diff.scm index b2527b9e9..7e04937ba 100644 --- a/module/scripts/api-diff.scm +++ b/module/scripts/api-diff.scm @@ -61,7 +61,7 @@ (meta (assq-ref alist 'meta)) (interface (assq-ref alist 'interface))) (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) (hashq-set! ht group '())) (assq-ref meta 'groups)) diff --git a/module/srfi/srfi-10.scm b/module/srfi/srfi-10.scm index 533d9f769..f63994910 100644 --- a/module/srfi/srfi-10.scm +++ b/module/srfi/srfi-10.scm @@ -54,7 +54,7 @@ ;; This hash table stores the association between comma-hash tags and ;; 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 ;; for the comma-hash tag @var{symbol}. |