On Mon, Feb 25, 2008 at 10:23:09AM +0100, Tiphaine.Turpin wrote:
I will try to state at an abstract level what I would like to do :
- define parametric virtual classes A and B so that every A has a Bs
(one or many...) and vice-versa.
- possibly extend A and B to A' and B' respectively, so that every A'
has B's (and not just Bs), etc.
- subtyping: possibly extend B to B1 and B2 so that their objects have
As, but those As still have Bs, so that I can associate the same A to
objects of class B, B1 or B2.
- and the ultimate goal combining all that: define A and B as above,
other virtual classes C and D in a similar way and E and F too, and
define concrete classes X Y Z1 Z2 just by saying that X extends A, Y
will play the role of B in the first two classes and the role of C in
the last two ones, and Z1 Z2 extends D (both) and E and F
(respectively). It happens that some of the types that were left
parametric (respectively methods defined as virtual) in B are made
concrete in C, (and so on), so I obtain my final concrete classes.
If you manage to find a simple type system for that, preferably with
type inference and principal typings, I'd like to see it :-)