1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

define* in module-observe-weak

* module/ice-9/boot-9.scm (module-observe-weak): Use define*.
This commit is contained in:
Andy Wingo 2010-05-21 23:37:54 +02:00
parent d6e70467ba
commit 723ae5b370

View file

@ -1633,7 +1633,7 @@ If there is no handler at all, Guile prints an error and then exits."
(set-module-observers! module (cons proc (module-observers module)))
(cons module proc))
(define (module-observe-weak module observer-id . proc)
(define* (module-observe-weak module observer-id #:optional (proc observer-id))
;; Register PROC as an observer of MODULE under name OBSERVER-ID (which can
;; be any Scheme object). PROC is invoked and passed MODULE any time
;; MODULE is modified. PROC gets unregistered when OBSERVER-ID gets GC'd
@ -1643,9 +1643,7 @@ If there is no handler at all, Guile prints an error and then exits."
;; The two-argument version is kept for backward compatibility: when called
;; with two arguments, the observer gets unregistered when closure PROC
;; gets GC'd (making it impossible to use an anonymous lambda for PROC).
(let ((proc (if (null? proc) observer-id (car proc))))
(hashq-set! (module-weak-observers module) observer-id proc)))
(hashq-set! (module-weak-observers module) observer-id proc))
(define (module-unobserve token)
(let ((module (car token))