[Top][All Lists]

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

Re: =?ISO-8859-1?Q?what's_"weakness"_in_elisp's_hash_table??=

From: Tim X
Subject: Re: =?ISO-8859-1?Q?what's_"weakness"_in_elisp's_hash_table??=
Date: Sun, 06 Jan 2008 20:45:26 +1100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

Xah Lee <> writes:

> in emacs lisp, when creating a hash table, there's the “:weakness”
> thing.
> See
> 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

reply via email to

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