help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object identity


From: Barry Margolin
Subject: Re: Object identity
Date: Tue, 21 Oct 2003 19:27:03 GMT

In article <mailman.2095.1066762882.21628.help-gnu-emacs@gnu.org>,
Lars Brinkhoff  <lars@nocrew.org> wrote:
>Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> > Is there a function, say object-identity, in Emacs Lisp that maps an
>> > object to a unique value (other than the object itself)?
>> I'm wondering what you want it for.
>
>In the implementation of Common Lisp's print-unreadable-object when
>:identity t is supplied.

AFAIK, there's no guarantee that the same object will print identically
over time.  Most implementations just display the object's current address;
if the GC moves it, the next time it's printed it will be different.  And
it's also possible for two different objects to display identically; in
between the two PRINT-UNREADABLE-OBJECT calls the GC could copy one of them
into the location that the other one used to occupy.

Anyway, there's a reason why Common Lisp requires that
PRINT-UNREADABLE-OBJECT be built into the implementation.  We didn't want
to expose an interface to getting these not-quite-unique identifiers.
They're not much use for anything other than this one function; if we
provided the API, users would undoubtedly misuse it.

-- 
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]