<div class="gmail_quote">On Sat, Apr 3, 2010 at 1:01 PM, Tobias C. Rittweiler <span dir="ltr"><<a href="mailto:tcr@freebits.de">tcr@freebits.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Let's say your Lisp development environment is multi-threaded and allows<br>
you to run multiple listeners at the same time. Each listener is run in<br>
its own thread.<br>
 Now, you opened a few listeners, then loaded in this library which<br>
pushes onto *DEFAULT-SPECIAL-BINDINGS*. Now all running listeners, when<br>
the user uses them to call into that library, will operate on the _same_<br>
global binding.</blockquote></div><div><br></div><div>Depending on the way special variable bindings are implemented, this could be easily achieved, but only with changes in the implementation.</div><div><br></div><div>One situation where this could not be done is when the implementation uses PROGV to create thread-local assignments. Typically each thread corresponds to a lambda form which is executed in a fresh new lexical environment and thus lambda form uses PROGV and the list of thread-local variables to establish those bindings. In this case I see no way to change the set of local assignments without a complicated manipulation of the binding stack, which might not be possible at all.</div>
<div><br></div><div>Other implementations like ECL use a hash table to implement special variable bindings. This  is the place where LET/LET* store the local bindings to a special variable and for this reason this table is looked up before anything else. Inserting a value into this table causes all bindings of the variable to be thread local. However this can only be done if there was no previous binding. In other words: we can make all new bindings thread-local but we can not turn a variable from global to thread-local if this variable already appears in a LET/LET* form.</div>
<div><br></div><div>Juanjo</div><div><br></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://tream.dreamhosters.com">http://tream.dreamhosters.com</a><br>