mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-21 12:10:26 +02:00
Make `(rnrs base)' independent of other rnrs modules.
* module/rnrs/base.scm (define-proxy): New macro. (raise, condition, make-error, make-assertion-violation, make-who-condition, make-message-condition, make-irritants-condition): Use it.
This commit is contained in:
parent
0e8a11c49a
commit
630b6588b7
1 changed files with 21 additions and 12 deletions
|
@ -123,24 +123,33 @@
|
||||||
(define (vector-map proc . vecs)
|
(define (vector-map proc . vecs)
|
||||||
(list->vector (apply map (cons proc (map vector->list vecs)))))
|
(list->vector (apply map (cons proc (map vector->list vecs)))))
|
||||||
|
|
||||||
(define-syntax raise
|
(define-syntax define-proxy
|
||||||
;; Resolve the real `raise' lazily to avoid a circular dependency
|
(syntax-rules (@)
|
||||||
;; between `(rnrs base)' and `(rnrs exceptions)'.
|
;; Define BINDING to point to (@ MODULE ORIGINAL). This hack is to
|
||||||
(syntax-rules ()
|
;; make sure MODULE is loaded lazily, at run-time, when BINDING is
|
||||||
((_ c)
|
;; encountered, rather than being loaded while compiling and
|
||||||
((@ (rnrs exceptions) raise) c))))
|
;; loading (rnrs base).
|
||||||
|
;; This avoids circular dependencies among modules and makes
|
||||||
|
;; (rnrs base) more lightweight.
|
||||||
|
((_ binding (@ module original))
|
||||||
|
(define-syntax binding
|
||||||
|
(identifier-syntax
|
||||||
|
(module-ref (resolve-interface 'module) 'original))))))
|
||||||
|
|
||||||
(define condition
|
(define-proxy raise
|
||||||
|
(@ (rnrs exceptions) raise))
|
||||||
|
|
||||||
|
(define-proxy condition
|
||||||
(@ (rnrs conditions) condition))
|
(@ (rnrs conditions) condition))
|
||||||
(define make-error
|
(define-proxy make-error
|
||||||
(@ (rnrs conditions) make-error))
|
(@ (rnrs conditions) make-error))
|
||||||
(define make-assertion-violation
|
(define-proxy make-assertion-violation
|
||||||
(@ (rnrs conditions) make-assertion-violation))
|
(@ (rnrs conditions) make-assertion-violation))
|
||||||
(define make-who-condition
|
(define-proxy make-who-condition
|
||||||
(@ (rnrs conditions) make-who-condition))
|
(@ (rnrs conditions) make-who-condition))
|
||||||
(define make-message-condition
|
(define-proxy make-message-condition
|
||||||
(@ (rnrs conditions) make-message-condition))
|
(@ (rnrs conditions) make-message-condition))
|
||||||
(define make-irritants-condition
|
(define-proxy make-irritants-condition
|
||||||
(@ (rnrs conditions) make-irritants-condition))
|
(@ (rnrs conditions) make-irritants-condition))
|
||||||
|
|
||||||
(define (error who message . irritants)
|
(define (error who message . irritants)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue