Behaviour of PROCLAIM in initialization file(s)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Triaged
|
Medium
|
Unassigned |
Bug Description
I have split up initialization files of common lisp implementations I use at the moment into two parts: things common to all implementations (like setting up ASDF paths) go into a common file (~/.common.lisp), and implementation specific things go into the respective files read by implementations. The common file is LOADed from the latter like so:
(load (merge-pathnames ".common.lisp" (user-homedir-
Now, while developing, I want to have high SAFETY and DEBUG settings, so I put the following proclamation in ~/.common.lisp:
(proclaim '(optimize (safety 3) (debug 3)))
The unexpected part is that the effects of this proclamation _persist_ if they are in ~/.sbclrc, but _do_not_persist_ if they are in ~/.common.lisp file (as found out by sb-ext:
Here is a test case (which most probably will have to be corrected):
(defun alists-same-p (a b &key (key-test 'eql) (value-test 'eql))
(loop
for (key . value) in a
always (let ((cons (assoc key b :test key-test)))
(and cons
(defun get-policy (&optional initfile)
(read-from-string
(with-
(run-program "/usr/local/
(defun test ()
(flet ((write-to-file (file-name form)
(write form :stream out))))
(let* ((proclaim-file "proclaim.tmp")
(
(
(
(let ((default-policy (get-policy nil))
;; This is not really a failure, just my lazyness of making a
;; generic-enough testcase.
;; This is what we really want to be true, but it will only work
;; if the previous assertion holds.
[15:51] <Krystof> I think that where people nowadays say (declaim ...) they really mean (eval-when (:compile-toplevel) (proclaim '(...)))
[15:51] <nikodemus> well, PROCLAIM is broken now. i think unbreaking it and making DECLAIM somewhat differently broken might be a win here :)
[15:52] <Krystof> I think I'd be happy with that
[15:53] <Krystof> (declaim ...) => (progn (eval-when (:compile-toplevel :execute) (something)) (eval-when (:load-toplevel) (something-else))) maybe
[15:53] <jsnell> you mean declaim having no :load-toplevel or :execute? that does not sound good
[15:53] <Krystof> I think I mean declaim optimize having no load-toplevel