mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-03 16:20:39 +02:00
Refactor (ice-9 deprecated) to be more concise
* module/ice-9/deprecated.scm (define-deprecated-trampoline): (define-deprecated-trampolines): New helpers. Use them to define all the trampolines.
This commit is contained in:
parent
c794c086d5
commit
7d899fa7c7
1 changed files with 58 additions and 154 deletions
|
@ -56,10 +56,31 @@
|
||||||
exp)))
|
exp)))
|
||||||
(export rule)))
|
(export rule)))
|
||||||
|
|
||||||
(define (make-guardian*)
|
(define-syntax define-deprecated-trampoline
|
||||||
(issue-deprecation-warning
|
(lambda (stx)
|
||||||
"make-guardian in the default environment is deprecated. Import it
|
(syntax-case stx ()
|
||||||
from (ice-9 guardians) instead.")
|
((_ ((mod proc) . params) exp)
|
||||||
|
(let* ((proc* (datum->syntax #'proc
|
||||||
|
(symbol-append (syntax->datum #'proc) '*)))
|
||||||
|
(msg (string-append
|
||||||
|
(symbol->string (syntax->datum #'proc))
|
||||||
|
" in the default environment is deprecated.\n"
|
||||||
|
"Import it from " (object->string (syntax->datum #'mod))
|
||||||
|
" instead.")))
|
||||||
|
#`(define* (#,proc* . params)
|
||||||
|
(issue-deprecation-warning #,msg)
|
||||||
|
exp))))))
|
||||||
|
|
||||||
|
(define-syntax define-deprecated-trampolines
|
||||||
|
(lambda (stx)
|
||||||
|
(syntax-case stx ()
|
||||||
|
((_ mod (proc arg ...) ...)
|
||||||
|
#'(begin
|
||||||
|
(define-deprecated-trampoline ((mod proc) arg ...)
|
||||||
|
(proc arg ...))
|
||||||
|
...)))))
|
||||||
|
|
||||||
|
(define-deprecated-trampolines (ice-9 guardians)
|
||||||
(make-guardian))
|
(make-guardian))
|
||||||
|
|
||||||
(define* (module-observe-weak module observer-id #:optional (proc observer-id))
|
(define* (module-observe-weak module observer-id #:optional (proc observer-id))
|
||||||
|
@ -67,170 +88,53 @@ from (ice-9 guardians) instead.")
|
||||||
"module-observe-weak is deprecated. Use module-observe instead.")
|
"module-observe-weak is deprecated. Use module-observe instead.")
|
||||||
(module-observe module proc))
|
(module-observe module proc))
|
||||||
|
|
||||||
(define (make-object-property*)
|
(define-deprecated-trampolines (ice-9 object-properties)
|
||||||
(issue-deprecation-warning
|
(make-object-property)
|
||||||
"make-object-property in the default environment is deprecated. Import
|
(object-properties obj)
|
||||||
it from (ice-9 object-properties) instead.")
|
(set-object-properties! obj props)
|
||||||
(make-object-property))
|
(object-property obj key)
|
||||||
|
|
||||||
(define (object-properties* obj)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"object-properties in the default environment is deprecated. Import
|
|
||||||
it from (ice-9 object-properties) instead.")
|
|
||||||
(object-properties obj))
|
|
||||||
|
|
||||||
(define (set-object-properties!* obj props)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"set-object-properties! in the default environment is deprecated. Import
|
|
||||||
it from (ice-9 object-properties) instead.")
|
|
||||||
(set-object-properties! obj props))
|
|
||||||
|
|
||||||
(define (object-property* obj key)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"object-property in the default environment is deprecated. Import
|
|
||||||
it from (ice-9 object-properties) instead.")
|
|
||||||
(object-property obj key))
|
|
||||||
|
|
||||||
(define (set-object-property!* obj key value)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"set-object-properties! in the default environment is deprecated. Import
|
|
||||||
it from (ice-9 object-properties) instead.")
|
|
||||||
(set-object-property! obj key value))
|
(set-object-property! obj key value))
|
||||||
|
|
||||||
(define* (make-weak-key-hash-table* #:optional (n 0))
|
(define-deprecated-trampoline (((ice-9 weak-tables) make-weak-key-hash-table)
|
||||||
(issue-deprecation-warning
|
#:optional (n 0))
|
||||||
"make-weak-key-hash-table in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 weak-tables) instead.")
|
|
||||||
(make-weak-key-hash-table))
|
(make-weak-key-hash-table))
|
||||||
|
(define-deprecated-trampoline (((ice-9 weak-tables) make-weak-value-hash-table)
|
||||||
(define* (make-weak-value-hash-table* #:optional (n 0))
|
#:optional (n 0))
|
||||||
(issue-deprecation-warning
|
|
||||||
"make-weak-value-hash-table in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 weak-tables) instead.")
|
|
||||||
(make-weak-value-hash-table))
|
(make-weak-value-hash-table))
|
||||||
|
(define-deprecated-trampoline (((ice-9 weak-tables) make-doubly-weak-hash-table)
|
||||||
(define* (make-doubly-weak-hash-table* #:optional (n 0))
|
#:optional (n 0))
|
||||||
(issue-deprecation-warning
|
|
||||||
"make-weak-key-hash-table in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 weak-tables) instead.")
|
|
||||||
(make-doubly-weak-hash-table))
|
(make-doubly-weak-hash-table))
|
||||||
|
|
||||||
(define (weak-key-hash-table?* x)
|
(define-deprecated-trampolines (ice-9 weak-tables)
|
||||||
(issue-deprecation-warning
|
(weak-key-hash-table? x)
|
||||||
"weak-key-hash-table? in the default environment is deprecated.
|
(weak-value-hash-table? x)
|
||||||
Import it from (ice-9 weak-tables) instead.")
|
|
||||||
(weak-key-hash-table? x))
|
|
||||||
|
|
||||||
(define (weak-value-hash-table?* x)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"weak-value-hash-table? in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 weak-tables) instead.")
|
|
||||||
(weak-value-hash-table? x))
|
|
||||||
|
|
||||||
(define (doubly-weak-hash-table?* x)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"doubly-weak-hash-table? in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 weak-tables) instead.")
|
|
||||||
(doubly-weak-hash-table? x))
|
(doubly-weak-hash-table? x))
|
||||||
|
|
||||||
(define (supports-source-properties?* x)
|
(define-deprecated-trampolines (ice-9 source-properties)
|
||||||
(issue-deprecation-warning
|
(supports-source-properties? x)
|
||||||
"supports-source-properties? in the default environment is deprecated.
|
(source-properties x)
|
||||||
Import it from (ice-9 source-properties) instead.")
|
(set-source-properties! x alist)
|
||||||
(supports-source-properties? x))
|
(source-property x k)
|
||||||
|
(set-source-property! x k v)
|
||||||
(define (source-properties* x)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"source-properties in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 source-properties) instead.")
|
|
||||||
(source-properties x))
|
|
||||||
|
|
||||||
(define (set-source-properties!* x alist)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"set-source-properties! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 source-properties) instead.")
|
|
||||||
(set-source-properties! x alist))
|
|
||||||
|
|
||||||
(define (source-property* x k)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"source-property in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 source-properties) instead.")
|
|
||||||
(source-property x k))
|
|
||||||
|
|
||||||
(define (set-source-property!* x k v)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"set-source-property! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 source-properties) instead.")
|
|
||||||
(set-source-property! x k v))
|
|
||||||
|
|
||||||
(define (cons-source* orig x y)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"cons-source in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 source-properties) instead.")
|
|
||||||
(cons-source orig x y))
|
(cons-source orig x y))
|
||||||
|
|
||||||
(define (array-fill!* array fill)
|
(define-deprecated-trampolines (ice-9 arrays)
|
||||||
(issue-deprecation-warning
|
(array-fill! array fill)
|
||||||
"array-fill! in the default environment is deprecated.
|
(array-copy! src dst)
|
||||||
Import it from (ice-9 arrays) instead.")
|
(array-copy-in-order! src dst)
|
||||||
(array-fill! array fill))
|
|
||||||
|
|
||||||
(define (array-copy!* src dst)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-copy! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(array-copy! src dst))
|
|
||||||
|
|
||||||
(define (array-copy-in-order!* src dst)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-copy-in-order! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(array-copy-in-order! src dst))
|
|
||||||
|
|
||||||
(define (array-map!* dst proc . src*)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-map! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(apply array-map! dst proc src*))
|
|
||||||
|
|
||||||
(define (array-for-each* proc array . arrays)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-for-each in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(apply array-for-each proc array arrays))
|
|
||||||
|
|
||||||
(define (array-index-map!* array proc)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-index-map! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(array-index-map! array proc))
|
(array-index-map! array proc))
|
||||||
|
|
||||||
(define (array-equal?* . arrays)
|
(define-deprecated-trampoline (((ice-9 arrays) array-map!) dst proc . src*)
|
||||||
(issue-deprecation-warning
|
(apply array-map! dst proc src*))
|
||||||
"array-equal? in the default environment is deprecated.
|
(define-deprecated-trampoline (((ice-9 arrays) array-for-each) proc array . arrays)
|
||||||
Import it from (ice-9 arrays) instead.")
|
(apply array-for-each proc array arrays))
|
||||||
|
(define-deprecated-trampoline (((ice-9 arrays) array-equal?) . arrays)
|
||||||
(apply array-equal? arrays))
|
(apply array-equal? arrays))
|
||||||
|
(define-deprecated-trampoline (((ice-9 arrays) array-slice-for-each) frame-rank proc . arrays)
|
||||||
(define (array-slice-for-each* frame-rank proc . arrays)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-slice-for-each in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(apply array-slice-for-each frame-rank proc arrays))
|
(apply array-slice-for-each frame-rank proc arrays))
|
||||||
|
(define-deprecated-trampoline (((ice-9 arrays) array-slice-for-each-in-order) frame-rank proc . arrays)
|
||||||
(define (array-slice-for-each-in-order* frame-rank proc . arrays)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-slice-for-each-in-order in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(apply array-slice-for-each-in-order frame-rank proc arrays))
|
(apply array-slice-for-each-in-order frame-rank proc arrays))
|
||||||
|
(define-deprecated-trampoline (((ice-9 arrays) array-cell-ref) array . indices)
|
||||||
(define (array-cell-ref* array . indices)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-cell-ref in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(apply array-cell-ref array indices))
|
(apply array-cell-ref array indices))
|
||||||
|
(define-deprecated-trampoline (((ice-9 arrays) array-cell-set!) array val . indices)
|
||||||
(define (array-cell-set!* array val . indices)
|
|
||||||
(issue-deprecation-warning
|
|
||||||
"array-cell-set! in the default environment is deprecated.
|
|
||||||
Import it from (ice-9 arrays) instead.")
|
|
||||||
(apply array-cell-set! array val indices))
|
(apply array-cell-set! array val indices))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue