Re: More brain damage



On Wed, 8 Dec 1999, Nat Friedman wrote:

> Elliot Lee writes:
>  > Why did you change to using gnome_object_get_epv() from having
>  > gnome_object_epv?
> 
>     There was actually a good reason for this.  What we were doing
> before, to subclass an interface, was:
> 
>     square_vepv.Base_Epv   = &the_base_epv;
>     square_vepv.Shape_Epv  = &the_shape_epv;
>     square_vepv.Square_Epv = &the_square_epv;
> 
> But this has problems, because, in order to override a method of a
> parent class, you have to manually duplicate the epv for it.  With the 
> current scheme, it's just this:
> 
>     square_vepv.Base_Epv   = base_get_epv ();
>     square_vepv.Shape_Epv  = shape_get_epv ();
>     square_vepv.Square_Epv = square_get_epv ();
> 
>     /* Override the default shape render method. */
>     square_vepv.Shape_Epv->render = Square_renderer;
> 
> I know you're going to complain that this is a waste of memory, but
> the epv's are only allocated once per class, and they're pretty small.

You should create a new epv for the subclass if needed, by copying the
parent class' one. This would only allocate memory for the extremely
unusual case, without penalizing

I think you are trying to achieve implementation inheritance, which CORBA
_so_ does not support, and is probably a really bad idea even ignoring
this problem.

-- Elliot
Rome did not create a great empire by having meetings, they did it by
killing all who opposed them.




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