Re: Introducing "toggle references"



On Thu, 2005-04-28 at 13:08 +0200, Alexander Larsson wrote:
> Ok, I have a better idea.
> What if we use the toggle references in the other way.

This is what gtk2-perl does currently ... it works better *if*
it's implementable in the language runtime.


[...]

> I think I have a solution that should work in general. What you do is
> split up the Proxy into two objects, one keeping all the data for the
> proxy, and the other one is just a facade that you give out to other
> objects to use as a reference. The Proxy Data object knows about the
> facade object, but only through a weak reference, so when the facade
> is not referenced anymore we'll get told, and we can change our
> reference on the GObject from a strong to a weak ref.

This doesn't work for the case of derivation ... because the identity
between the public proxy object and the place where the data is stored
is exposed to the user of the language binding

 (But that only can apply to one language binding at once)

It also doesn't work for the Python case of simply stuffing stuff
into the objects dict.

 (But we don't need toggle references for Python)

It does seem like it could be used in the third case I mentioned ...
where we want to keep closure callbacks in a place that is visible
to the language runtime.

So, perhaps the hybrid setup where we use the two-part object for
foreign references (references to GObjects not created from Java)
and use toggle references for native references (references to GObjects
created from Java) would solve most of the problems.

Pretty complex, however. :-)
					Owen


Attachment: signature.asc
Description: This is a digitally signed message part



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