Does emacs lisp have a function that provides a unique object identifier, such as e.g. a memory address? Python has id(), which returns an integer guaranteed to be unique among presently existing objects. What about elisp?
Does emacs lisp have a function that provides a unique object identifier, such as
Share
My whole point in asking the question was that I was looking for a way to distinguish between the printed representations of different symbols that have the same name. Thanks to the elisp manual, I’ve discovered the variable
print-gensym, which, when non-nil, causes#:to be prepended to uninterned symbols printed. Moreover, if the same call toprintprints the same uninterned symbol more than once, it will mark the first one with#N=and subsequent ones with `#N#. This is exactly the kind of functionality I was looking for. For example:The
#:notation works forreadas well:Note the
'on'#:foo–the#:notation is a symbol-literal. Without the', the uninterned symbol is evaluated: