From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!newsgate.cistron.nl!amsnews01.chello.com!news01.chello.no!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: IDENTITY-OF function References: <661755b5.0202130649.395395ee@posting.google.com> Mail-Copies-To: never From: Erik Naggum Message-ID: <3222609858748033@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 40 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 13 Feb 2002 17:24:16 GMT X-Complaints-To: abuse@chello.no X-Trace: news01.chello.no 1013621056 212.186.234.171 (Wed, 13 Feb 2002 18:24:16 MET) NNTP-Posting-Date: Wed, 13 Feb 2002 18:24:16 MET X-Received-Date: Wed, 13 Feb 2002 18:24:27 MET (news01.chello.no) Xref: archiver1.google.com comp.lang.lisp:26442 * Will Fitzgerald | For various reasons -- mostly having to do with serializing Lisp data or | remote procedure calls -- it seems useful to have an 'identity-of' | function which returns a (unique) identity for a Lisp object. The Lisp object _is_ its identity, so identity-of is already implemented: it is the function identity. | If identity is true, the output from forms is followed by a space | character and a representation of the object's identity, typically a | storage address. That is only (intended to be) useful for debugging purposes. | 1. Are there implementation specific functions that do what I want? Well, you can get the address of a Lisp object in most implementations, but what good will it do? Even when you use print-unreadable-object, there is no guarantee that the identity will actually remain the same over any period of time. Most Common Lisp implementations utilize a memory management system that can move objects around in memory. | 2. Do you think the following (which returns the identity as a string) | is reasonably portable? If you want portable, use an eq hashtable that maps to a unique numeric object identifier that you request for each object. Note that this entangles you in the annoying object ownership protocol business. You may get around this problem with a weak key. A bidirectional hashtable does not exist, so you may have to use another with the identifier as key and a weak value, instead. If you need this for RPC, what good is the "identity" if it is not understood on the other side of the communication? I must be missing something important here. /// -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief.