From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Object identity Date: Tue, 21 Oct 2003 16:19:59 GMT Organization: Level(3) Communications, Woburn, MA Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1066754016 25672 80.91.224.253 (21 Oct 2003 16:33:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 21 Oct 2003 16:33:36 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 21 18:33:33 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ABzRt-0000Ic-00 for ; Tue, 21 Oct 2003 18:33:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ABzP1-0006G2-9g for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Oct 2003 12:30:35 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!elnk-pas-nf1!newsfeed.earthlink.net!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!crtntx1-snh1.gtei.net!news.gtei.net!news.level3.com.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help Mail-Copies-To: never X-Newsreader: trn 4.0-test72 (19 April 1999) Originator: barmar@genuity.net (Barry Margolin) Original-Lines: 29 Original-NNTP-Posting-Host: 171.78.176.30 Original-X-Trace: news.level3.com 1066753199 171.78.176.30 (Tue, 21 Oct 2003 16:19:59 GMT) Original-NNTP-Posting-Date: Tue, 21 Oct 2003 16:19:59 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:117491 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13422 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13422 In article , Stefan Monnier wrote: >I still have no clue what it's useful for, so I tend to find such research >rather pointless. But I'm probably just missing the point. The OP explained what it's useful for: emulating weak hash tables in a system that doesn't have them built in. If you use ordinary hash tables, then using an object as a key will prevent it from ever becoming garbage, which is like a memory leak. If implementing an identity function like the one the OP requests results in every object being larger (due to a design like the one I described), it's likely that this overhead will be much greater than the memory leak in his application. So the net result is that he would be better off letting the memory leak. Another possibility is to implement an application-specific object-identity function. If all the objects that the application needs to deal with are implemented as lists or structures, he can add an id-code slot to all of them. The object-identity function can maintain a counter, and store the current value into this slot into the object if it's not filled in yet. This way, the overhead cost is only paid for the few objects that need it, rather than every Lisp object. -- 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.