wanted: EQUALP/EQUAL/EQL for SAPs

Bug #671259 reported by 3b
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Confirmed
Wishlist
Unassigned

Bug Description

CFFI uses SB-SYS:INT-SAPs as foreign pointers on sbcl, but since SAPs can't be compared with with EQ/EQL/EQUAL/EQUALP, they can't be used as keys in a hash table without using a non-portable test, or extracting the pointer value by hand and using that as a key.

test cases:
(let ((h (make-hash-table :test 'equalp)))
  (setf (gethash (cffi:make-pointer 12345) h) 123)
  (gethash (cffi:make-pointer 12345) h))

expected 123,T
actual results NIL,NIL, on sbcl 1.0.43.78 linux x86-64

Works on CCL, using EQL, EQUAL and EQUALP

There was some related discussion on #sbcl (~18:50 in http://ccl.clozure.com/irc-logs/sbcl/2010-09/sbcl-2010.09.19.txt), but nothing was decided.

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

I suspect SAPs could very well be EQL-comparable since they are immutable.

Though I think I was opposed to EQLness in that discussion, or at least sceptical, on reflection EQL comparison does sound right "numberlike immutable objects" -- but I'm still on the fence re. extending a very primitive standard operator.

However, re: CFFI, pointers, and hash-tables: I believe the portable solution is to use CFFI:POINTER-ADDRESS as the key.

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
importance: Undecided → Wishlist
status: New → Confirmed
Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.