I am trying to figure out how software like SLIME or SLY gets the memory addresses of variables as it displays them in the Inspector. What Common Lisp function could I use to be able to do this programatically?
Example:
It is the #x100cab066d1 that is of interest here.

 
                        
You don't want to: garbage collection may (and often does!) move objects, so the address of an object may be different between observations. Another problem is posed by immediate objects (e.g.,
1or#\A) - what would their addresses be?!That said, ANSI CL offers the
:identityargument toprint-unreadable-objectwhich most lisps interpret to mean the current address in memory.Alas, the output format is implementation-dependent (e.g., SBCL wraps the address in
{}), so it is better to find the implementation-specific function which returns the address.Using
apropos, we easily findsystem::address-ofin CLISP;sb-kernel:get-lisp-obj-addressin SBCL.PS. Check out
sxhash- could that be what you are looking for?