Robert Goldman writes:
Fare wrote:
Do we need a :after method to restore the old settings? I'm not sure how to do that actually, since I don't believe there's a portable way to record them. Do you have thoughts about this?
(rpg replied to me in private but I'm Cc'ing back the list)
At ITA, we actually use a :around method with
(defun call-with-local-compilation-settings (thunk) (let #+clozure ((ccl::*nx-speed* ccl::*nx-speed*) (ccl::*nx-space* ccl::*nx-space*) (ccl::*nx-safety* ccl::*nx-safety*) (ccl::*nx-cspeed* ccl::*nx-cspeed*) (ccl::*nx-debug* ccl::*nx-debug*)) #+sbcl ((sb-c::*policy* sb-c::*policy*)) #-(or clozure sbcl) () (funcall thunk)))
(defmacro with-local-compilation-settings (() &body body) `(call-with-local-compilation-settings (lambda () ,@body)))
Gary, got some Allegro fu that we could shovel into with-local-compilation-settings?
A somewhat-portable way would be to query current optimization settings, and reset them appropriately. ("somewhat-portable" because the environment access stuff specified in CLtL2 allows for the querying.)
This way you also can easily define a default value for implementations where you do not (yet) know how to get that information from; my gut feeling for the default values would be (debug 2) (speed 2) (safety 2).
-T.