[M3devel] "target specific pragmas"?

hendrik at topoi.pooq.com hendrik at topoi.pooq.com
Sun Feb 17 14:16:59 CET 2008


On Thu, Feb 14, 2008 at 12:31:50PM -0500, Tony Hosking wrote:
> On Feb 14, 2008, at 3:12 AM, Olaf Wagner wrote:
> 
> [...many other good comments deleted...]
> 
> 
> >Multiple inheritance was left out of the language after long
> >discussions because it was not really understood at that time.
> >It may be that things have changed in this respect, but I still
> >don't think it is.
> 
> Multiple inheritance is fine so long as it encodes only type, but  
> *not* if it encodes representation as well.  Witness single  
> inheritance for classes in Java, versus multiple inheritance for  
> interfaces in Java.  That seems to be the general consensus these days.

Multiple inheritance could still work under the constraint that no two 
ancestors provided different representations for any feature.  I'd count 
separate definitions of a virtual function as different even if their 
code happens to be textually identical.  Then an interface (like in 
Java) would be nothing but a class that has no representation.

Then to build a class you could combine little chunks of representation, 
much as a linker combines little pieces of program.  and multiple 
MODULEs can implement parts of the same INTERFACE.  And by combining 
chunks chunks differently you could build classes with different 
behaviour.  This would make more code-sharing is feasible, without a 
crisis in semantics.

I could consider adding the following clause, because I think it would 
help modularity (though I'm not sure it's necessary):
   But if both ancestors have the same defined representation but they 
   are ultimately inherited from the same definition, I'd count them as 
   the same (though I could be argued out of this clause).

Actully, I suppose this might be necessary because all objects inherit 
representation from OBJECT, and a general rule might be better than a 
special case for OBJECT.

-- hendrik



More information about the M3devel mailing list