Re: Bonobo::Unknown



Mathieu Lacage <lacage@email.enst.fr> writes:

> hi all,
> 
> Once more during my long code reading of Bonobo implementation, I have come to the folowing 
> problem:
> 
> the bonobo_object_add_interface doc says: 
> /**
>  * bonobo_object_add_interface:
>  * @object: The BonoboObject to which an interface is going to be added.
>  * @newobj: The BonoboObject containing the new interface to be added.
>  *
>  * Adds the interfaces supported by @newobj to the list of interfaces
>  * for @object.  This function adds the interfaces supported by
>  * @newobj to the list of interfaces support by @object.
>  */
> 
> should it not be: 
> 
> /**
>  * bonobo_object_add_interface:
>  * @object: The BonoboObject to which an interface is going to be added.
>  * @newobj: The BonoboObject containing the new interface to be added.
>  *
>  * Adds the interfaces supported by @newobj to the list of interfaces
>  * for @object.  This function also adds the interfaces supported by
>  * @object to the list of interfaces supported by @newobj.
>  */

I don't know if that makes things more clear. add_interface actually
makes the two objects functionally identical.

> Also, imagine I have A, B and C with interfaces IA, IB, and IC.
> 
> I make: 
> bonobo_object_add_interface (A, B)
> bonobo_object_add_interface (A, C)
> B = bonobo_object_QI (A, IB)
> bonobo_object_QI (B, IC)   ------> this will not return C.
> 
> object B does not know about object C.

That is not correct. the final expression in your list above _will_
return C. `query_interface' is reflexive, transitive, and symmetric,
i.e. it is an equivalence relation.

`add_interface' merges the two arguments permanently and order does not
matter.

> The idea is that we add a list of the objects which have been added to an 
> interface. Then everytime we add a set of objects to another one, 
> we build the new linked list of the supported interfaces. 
> Then, we update the linked lists of the objects which had been added before to us.
> Then, we update the linked lists of the objects which had been added before to the
> object we have added to ourself.

In practice, that is what happens already, except the linked lists of
individual objects that have been add_interface'd together are shared.

> If I ask 
> bonobo_object_QI (A, Unknown)
> bonobo_object_QI (B, Unknown)
> I will not get the same result, I guess...

If A and B have been add_interface'd, you will get the same result, or
at least you should. If you don't, it is a bug.

I recommend reading at least the first three Chapters of Essential COM
to better understand the fundamental properties of COM, if you haven't
already.

 - Maciej




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