Re: dbus glib bindings: deriving from G_TYPE_BOXED, parameterized types



On Mon, 2005-05-16 at 15:16 +0200, Tim Janik wrote:
> On Fri, 13 May 2005, Matthias Clasen wrote:
> 
> > On Fri, 2005-05-13 at 13:01 -0400, Colin Walters wrote:
> 
> > As I just pointed out to Colin, using derivation to model the relation
> > between generic types and their specializations is not really adaequate,
> > since you violate the substitution principle: a List<int> can not be
> > substituted for a List, since List promises you to store arbitrary
> > objectds, while List<int> can only store ints (which is why generic
> > types systems like the one in Java 5 don't do it like this).
> 
> what kind of substitution is that? having an abstract or very generic
> base type (List) and specialization in derived types (List<int>) is
> fairly common practice in inheritance patterns.

The principle is that you should be able to treat instances of derived
types as if they were instances of the base type.

> > We may need a different way to model the "is a specialization of this
> > generic type" relation.
> 
> hm, and exactly why do we need that?
> 

Because it is useful information ?!

Matthias




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