This is the mail archive of the guile@cygnus.com mailing list for the guile project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Sascha Ziemann <szi@aibon.ping.de> writes:
> is there a way to get dynamic bindings in Guile to make this code
> printing "local"?
Real dynamic bindings should be thread-local. Currently, there is
only one way to achieve this in Guile:
(define doit (make-fluid))
(fluid-set! doit (lambda () (display "global\n")))
(define some-code '((fluid-ref doit)))
(define (dynamic code)
(with-fluids ((doit (lambda () (display "local\n"))))
(eval code)))
(dynamic some-code)
/mdj