Helmut Eller e9626484@stud3.tuwien.ac.at writes:
Nicolas Neuss Nicolas.Neuss@iwr.uni-heidelberg.de writes:
CL-USER> *READ-DEFAULT-FLOAT-FORMAT* SINGLE-FLOAT
When I then set the default format manually in the REPL, it is reset by `M-x slime'.
That could be a bug or a feature depending on your expectations.
Changing *READ-DEFAULT-FLOAT-FORMAT* globally is rather hard in SBCL. SBCL's native top level loop is executed within with-rebound-io-syntax, i.e. most reader variables have a non-toplevel binding in the initial thread and all our threads are spawned from that thread. In SBCL, a new threads inherits (all?) the dynamic bindings of the parent thread and so, if you change *READ-DEFAULT-FLOAT-FORMAT* in one thread, the change it will not be visible in other threads. M-x slime also creates a new threads and the bindings are those from the initial thread.
I've heard that SBCL's inheriting semantics for dynamic variables are an ongoing debate, maybe they change it.
Helmut.
Thank you for the explanation. Hmm, maybe I should allow my application to operate also with SINGLE-FLOAT. I fear, however, that the accuracy will usually not be sufficient such that this would put a burden on the user to set *READ-DEFAULT-FLOAT-FORMAT* to DOUBLE-FLOAT when starting up his/her Lisp. (This should be sufficient, I hope.)
At the moment, I simply do not use 'M-x slime' for bringing up the REPL, but this function:
(defun show-repl-maybe-start-slime () (interactive) (if (slime-connected-p) (slime-display-output-buffer) (slime))) (global-set-key [f9] 'show-repl-maybe-start-slime)
This works for CMUCL (no threads). For SBCL, I guess that I will set *READ-DEFAULT-FLOAT-FORMAT* also in my .sbclrc file.
Thanks again, Nicolas.