Login  Register

Decoration of Handles in ObjectHandlerXL

Posted by eric ehlers on Apr 20, 2006; 11:04am
URL: http://quantlib.414.s1.nabble.com/Decoration-of-Handles-in-ObjectHandlerXL-tp11090.html

Hi All

Problems have arisen with the ObjectHandler feature of decorating
object handles e.g. "my_object" -> "my_object_~xxxxx" and in CVS I've
disabled this feature.  Garbage collection continues to function as
before but the user is now responsible for guaranteeing that his
handles are unique.

If this causes problems please let me know.  Please see below if you
require further detail.

Many Thanks,
Eric


The user supplies a stub "my_object" and gets back "my_object_~xxxxx"
where xxxxx is a unique key used to link back to the calling cell for
purposes of garbage collection.    xxxxx gets incremented every time
the object is reconstructed.

Suppose the user wants to pass that object to another function. If he
just references the cell containing the object e.g. A3 then all is
well.  But suppose a reference to the calling cell isn't convenient.
The user knows he called his object "my_object" and wants to use that
handle but can't because the object is now called "my_object_~xxxxx".

The example presented to me is where we might use one of several
different workbooks to create rate helpers e.g. "1W", "1M", ... We
want to bootstrap the yield curve without worrying about which book
was used to create the helpers so we want to refer to the rate helpers
by their raw handles not by referencing the cell in which the rate
helper object resides.

In CVS I've commented out the old behavior and replaced it with a
tentative implementation of the new approach.  The "~xxxxx" is
retained internally for garbage collection which continues to function
as before but the user doesn't see this and is now responsible for
ensuring that his handles are unique (as has always been the case when
GC is disabled).  Longer term I would make some further refinements to
the new code I just want to make sure this change won't cause problems
for anyone.



It's been pointed out to me that there's a problem with
ObjectHandler's feature of taking a user-supplied handle e.g.
"my_object" and decorating it to "my_object_~xxxxx" to force
uniqueness and faciliate garbage collection.

I propose to suppress this decoration,

Some further detail below.

Thanks,
Eric