1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +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:
Andy Wingo 2019-09-27 22:28:34 +02:00
parent f62e19bd10
commit cc7d394490
8 changed files with 29 additions and 27 deletions

View file

@ -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'.

View file

@ -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)

View file

@ -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)))

View file

@ -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)))

View file

@ -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*)))

View file

@ -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!)

View file

@ -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))

View file

@ -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}.