This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: Something like vector-grow available?
Telford Tendys <telford@eng.uts.edu.au> writes:
> AFAIK, no there is not. The implementation of a vector is a simple malloc()
> and the chances for a realloc() on that working without doing a copy are
> pretty small. The copy inside realloc() is faster than anything you write
> in scheme though. Adding a vector-grow function to guile might be nice for
> just that reason and possibly for the reason that some future implementation
> might be smarter.
I need it to dynamically grow the weak observer array. Maybe I could
(ab-)use a weak hash table to hold the weak observers with the key
being the observer and the value always being #f.
Hmm, no. The weak observer array is an array, not a dictionary type.
On the other hand i think it should also shrink when all weak
observers have been garbage collected. Hmm, a weak list ... :)
This would all not be necessary if I could get a notification from
the garbage collector when a certain cell has been gc'ed. I think
this is not possible at the moment.
Jost