Dirk Gerrits dirk@dirkgerrits.com writes:
Something like this?
#+:sb-thread (when (find-package :swank-loader) (setf (sb-thread::symbol-value-in-thread *read-default-float-format* (the-right-thread)) 'long-float))
Sounds reasonable, but I haven't found the right thread yet. Any SLIME developers who can help?
The thread tree looks like this:
inferior-lisp (== SBCL REPL) _ socket server [usually dead] _ reader thread _ repl thread _ control thread _ worker thread1 _ worker thread2 ...
REPL command are executed by the repl thread. For the other request, a new worker thread is created by the control thread. So, the-right-thread(s) are probably the control thread and the repl thread.
sb-thread::symbol-value-in-thread doesn't appear to be setf-able here, but
(sb-thread:interrupt-thread (swank::connection.control-thread swank::*emacs-connection*) (lambda () (setq *read-default-float-format* 'long-float)))
seems to work.
The issue came up before but I still don't know what the proper fix is. SBCL is the only Lisp with the inherit-dynamic-variables-in-new-threads semantics. Implementing non-inheriting seems to be difficult in SBCL and implementing inheriting is difficult in the other Lisps. We could probably offer something like swank:setq-default to set initial values in the worker threads. Other ideas?
Helmut.