#. doesn't reset *backquote-count* around eval
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The sharp-dot reader in sharpm.lisp has a (let ((*backquote-count* 0)) ...) around its read, but not around its eval, which means that if you read or load code from within a #. you're going to have bad surprises:
* `#.(write-to-string (read-from-string "#(1 2 3)"))
"((SB-IMPL::|bqv|) 1 2 3)"
* `#.(compile () (read-from-string "(lambda () #(1 2 3))"))
; in: LAMBDA ()
; ((SB-IMPL::|bqv|) 1 2 3)
;
; caught ERROR:
; illegal function call
;
; compilation unit finished
; caught 1 ERROR condition
#<FUNCTION (LAMBDA ()) {1005B4F0AB}>
* (with-open-file (s "/tmp/foo.lisp" :direction :output :if-exists :rename-and-delete :if-does-not-exist :create) (format s "#(1 2 3)~%")) `#.(load "/tmp/foo.lisp")
;==> same error
In practice, you can't load or compile files from within a `#. — bad.
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
there's a problem with your second example for a different reason.