From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: =?ISO-8859-1?Q?what's_"weakness"_in_elisp's_hash_table??= Date: Sun, 06 Jan 2008 20:45:26 +1100 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87wsqnuw21.fsf@lion.rapttech.com.au> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1199616170 15512 80.91.229.12 (6 Jan 2008 10:42:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Jan 2008 10:42:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 06 11:43:11 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JBSy1-0002lD-FY for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Jan 2008 11:43:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBSxa-00005x-S7 for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Jan 2008 05:42:30 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn12feed!worldnet.att.net!216.168.1.165!sn-xt-sjc-05!sn-xt-sjc-09!sn-post-sjc-02!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:m2aI5myT1oqfuv6/oU30+zeCyP0= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 26 Original-Xref: shelby.stanford.edu gnu.emacs.help:155110 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50530 Archived-At: Xah Lee writes: > in emacs lisp, when creating a hash table, there's the “:weakness” > thing. > > See > http://xahlee.org/elisp/Creating-Hash.html > > what does that mean? Suppose if i do > > (setq myhash (make-hash-table :test 'equal :weakness 'key)) > (puthash "mary" "19" myhash) > ... > > Then, the "mary" would disappear if i don't access it?? > The entry with key 'mary' and value 19 will be removed from the hash table if it has no references i.e. it will be garbage collected. Normally, with :weakness set to nil, keys and values in a hash table are protected from garbage collection. -- tcross (at) rapttech dot com dot au