Steel Bank Common Lisp

backquote of constants should be constant

Reported by James Y Knight on 2012-07-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Wishlist
Unassigned

Bug Description

That is,
(defconstant +foo+ 1)
(defun foo () `(,+foo+))
should return a constant list, not cons up a new one every time.

Here's a patch. Seems to work.

I wonder if any of the complication in backq.lisp can be removed if it can assume the compiler does this.

James Y Knight (foom) wrote :
Stas Boukarev (stassats) wrote :

"Should" as in "the standard prescribes it" or in "it would be nice"?

tags: added: review
Changed in sbcl:
importance: Undecided → Wishlist
James Y Knight (foom) wrote :

Should as in "this is a significant missed optimization".

James Y Knight (foom) wrote :

BTW, here's some discussions about whether the result of backquote is considered mutable or not. The spec is not very clear, but it seems like the consensus is that backquote can return literal data whenever it feels like it. Which is good, because SBCL already does that in many cases. This just adds a few more cases. :)

https://groups.google.com/group/comp.lang.lisp/browse_thread/thread/74c41c41aeb80528
https://groups.google.com/group/comp.lang.lisp/browse_thread/thread/43e14ad1ba72dd0d
https://groups.google.com/group/comp.lang.lisp/browse_thread/thread/385f2adf7a3175fd

Paul Khuong (pvk) on 2013-04-23
Changed in sbcl:
status: New → Triaged
assignee: nobody → Paul Khuong (pvk)
Paul Khuong (pvk) on 2013-05-20
Changed in sbcl:
status: Triaged → In Progress
Paul Khuong (pvk) wrote :

Committed in f250391 (Constant-fold backquote of constant expressions)

Changed in sbcl:
status: In Progress → Fix Committed
assignee: Paul Khuong (pvk) → nobody
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