From: Tim X <timx@nospam.dev.null>
To: help-gnu-emacs@gnu.org
Subject: Re: =?ISO-8859-1?Q?what's_"weakness"_in_elisp's_hash_table??=
Date: Sun, 06 Jan 2008 20:45:26 +1100 [thread overview]
Message-ID: <87wsqnuw21.fsf@lion.rapttech.com.au> (raw)
In-Reply-To: be001af5-0978-48c1-975e-2fe461f712e3@s8g2000prg.googlegroups.com
Xah Lee <xah@xahlee.org> 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
prev parent reply other threads:[~2008-01-06 9:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 16:43 what's "weakness" in elisp's hash table? Xah Lee
2008-01-03 21:15 ` Tassilo Horn
2008-01-06 9:45 ` Tim X [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wsqnuw21.fsf@lion.rapttech.com.au \
--to=timx@nospam.dev.null \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).