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] |
Per Bothner <bothner@cygnus.com> writes: > > You have three threads. Thread a is in a repl. Threads b and c > > are cooperating on some task, and want to share a binding for > > (current-output-port). Thread a should have a different binding > > for (current-output-port). > > Assuming: > (define (current-output-port) *current-output-port*) > > and that: (fluid-let ((VAR)) BODY) > is syntactatic sugar for: (fluid-let ((VAR VAR)) BODY) > (I.e. create a new binding but initialize it to the current value); > > you can do: > > (future (fluid-let ((*current-output-port*)) (thread-a))) > ;; Or: (fluid-let ((*current-output-port*)) (future (thread-a))) > (fluid-let ((*current-output-port*)) > (future (thread-a)) > (future (thread-b))) Thanks. You have greatly improved my understanding of what's possible with fluid-let. Now I'm going to try to code this up as an actual example. -russ -- In theory, there is no difference between theory and practice. But, in practice, there is.