The hex number is the object address. It can change after a garbage collection. Your implementation may provide a function to get it directly, but I don't think you should use it.
What you might consider doing is adding a name
slot to your objects and automatically initializing them using, say, gensym
.
If you want to keep track of all your objects, you might even intern
the names in a special package and set their symbol-value
to the objects (beware that this will make the objects uncollectable by the GC until you unintern
their names, or unset their symbol-value
, or delete the aforementioned special package).
PS. You can get the object address even if you override print-object
- just pass :identity t
to print-unreadable-object
.
PPS. I am sure you know that (format nil "~A" x)
is the same as (princ-to-string x)
.