This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

nesting scm_protect/unprotect_object


Hi!

I realized that in cvs nesting for scm_protect/unprotect_object is
supported now. However, the comment that indicated that a better
implementation was to use hashtables disappeared, although I think that
the current implementation is fairly ineffective: 
- the global list scm_protects holds the elements which are to be protected
- every call to protect performs a scm_protect = cons(obj, scm_protect)
- every call to unprotect removes the object exactly once from scm_protect.

If the nesting of protect/unprotect calls follows the nesting of procedure
calls, there wouldn't be any problem: The element at the front of the
list is the one that is to be removed. But such a nesting is not very
probable for objects that are allocated on the heap.

Thus I propose to somehow put a reimplementation of this mechanism on a
TODO list, maybe with lowest priority.

Best regards, 
Dirk Herrmann