#. doesn't reset *backquote-count* around eval

Bug #1321047 reported by Faré on 2014-05-20
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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.

Douglas Katzman (dougk) wrote :

there's a problem with your second example for a different reason.

Changed in sbcl:
status: New → Fix Committed
Faré (fahree) wrote :

I don't see the commit — can you push?

What was wrong with my second example?

Douglas Katzman (dougk) wrote :


oh, never mind my remark. I copied-and-pasted badly.

Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers