This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Using SCMs as hash keys
Andrew Chadwick <andrew.chadwick@symbian.com> writes:
> Actually the hash table is a GHashTable from GLib (it must be queried
> quickly and regularly from the C side, but never from the Scheme side)
> But thanks for the warning; the hash does need adding to and deleting
> from fairly frequently too.
>
> Perhaps it would be simpler to scm_protect_object() a vector on the
> Scheme side. Would a scm_vector_set_length_x() followed by a
> scm_vector_set_x() be any quicker?
I'm suggesting that you simply create your own equivalent of
scm_protect_object() using a scheme hash table allocated with
scm_make_vector(). You can use scm_hashq_set_x, etc. to put your keys
into this hash table, and just call scm_protect_object() on the hash
table. Maybe we are in perfect agreement; I can't quite tell from
your email.
-russ
--
Computers are not intelligent. They only think they are.