(define-module gauche.parameter (use gauche.hook) (export <parameter> make-parameter parameterize parameter-pre-observers parameter-post-observers parameter-observer-add! parameter-observer-delete!))
(select-module gauche.parameter)
(dynamic-load "gauche-parameter-lib")
(define-syntax parameterize (syntax-rules () ((_ (binds |...|) . body) (%parameterize () () () () (binds |...|) body))))
(define-syntax %parameterize (syntax-rules () ((_ (param |...|) (val |...|) (tmp1 |...|) (tmp2 |...|) () body) (let ((tmp1 val) |...| (tmp2 #f) |...|) (dynamic-wind (lambda () (set! tmp2 (param tmp1)) |...|) (lambda () . body) (lambda () (param tmp2) |...|)))) ((_ (param |...|) (val |...|) (tmp1 |...|) (tmp2 |...|) ((p v) . more) body) (%parameterize (param |...| p) (val |...| v) (tmp1 |...| tmp1a) (tmp2 |...| tmp2a) more body)) ((_ params vals vars other body) (syntax-error "malformed binding list for parameterize" other))))
(provide "gauche/parameter")
