Re: Pluggable widget types and implementations



On Sun, 2006-12-10 at 14:21 +0100, Tim Janik wrote: 
> On Sun, 10 Dec 2006, Damon Chaplin wrote:
> 
> > On Fri, 2006-12-08 at 18:36 +0100, Tim Janik wrote:
> >
> >> i'm still interested in hearing use cases for multiple factories though,
> >> so if anyone has arguments for allowing multiple GFactory* handles instead
> >> of just two "singleton" functions:
> >>
> >>    /* craete instance conforming to prerequisite_type */
> >>    g_factory_create (GType prerequisite_type);
> >>
> >>    /* appoint an implementaiton_type for a prerequisite_type */
> >>    g_factory_appoint_type (GType prerequisite_type,
> >>                            GType implementation_type);
> >
> > I think the terms "appoint" and "prerequisite" are a bit confusing.
> >
> > I'd prefer the simpler:
> >    g_factory_create (GType type);
> >
> >    g_factory_override_type (GType original_type,
> >                             GType override_type);
> 
> well, "prerequisite" is consistent with established naming in the type system,

Yes, but it is used in a slightly different sense. Saying something is a
prerequisite of something else (implying some sort of dependency) is
easy to understand.

But "g_factory_create (GType prerequisite_type)" isn't implying any
dependency, so I personally find it a bit confusing. Whereas I can
understand the simple "g_factory_create (GType type);" very easily.



> and "override" doesn't really seem appropriate if prerequisite_type is a
> non-instantiale interface type, and implementation_type is an instance type
> which happens to implement the interface type.

Yes, that's true.

> any other suggestions for replacing "appoint"?

How about:
  g_factory_set_implementation (GType type,
                                GType implementation);

Damon





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