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

multiple inheritance



I'll throw this out as another possibility.  I think I discussed an
idea like this privately with Kelsey but it didn't make it into his
proposal (perhaps for good reason :-).  This has not been field tested,
it's just something rolling around in my mind...

The issue of multiple inheritance is that a single situation might
have multiple descriptions.  One way to handle that is to give it a
single, unified description.  But there is another: to give it
multiple descriptions that are signaled at the same time... well, in
an interleaved or co-routined way, anyway.

Using single inheritance, it would be possible to represent those
things that one can as clumps and to do a kind of co-signal operation,
in which not (necessarily) one but (usually) multiple objects were
signaled simultaneously.  That is, at each handler, you'd try (in
succession) the handler on each of the conditions, so that you didn't
move to an outer handler until the inner handler had been given the
chance to handle all presentations of the condition.

At the lowest level, a handler could receive a list of conditions rather
than a single condition, and it could just typically be that there was only
one and that a simpler primitive, signal, was just

(define (signal condition) (co-signal (list condition)))

It's possible that some handlers would actually want to see both at
once, but for many purposes, it would simply work to do the
try-in-succession thing.

So co-signaling C1 and C2 for handlers H3 H2 H1 (inner to outer) would
try (in this order):
  H3 with C1
  H3 with C2
  H2 with C1
  H2 with C2
  H1 with C1 and
  H1 with C2.

Among the advantages:
 - An advantage is that this gets around complex problems in type overlap
   that come up in multiple inheritance  (what to do about slots
   inherited by each of two mixed types which for the purposes of each
   type want different values).
 - This would avoid the multiple inheritance question, making some people 
   very happy.

Among the disadvantages:
 - the signaling system is complicated by the need to presume that all
   conditions potentially have multiple presentations
 - this hasn't ever been tried
 - This would avoid the multiple inheritance question, making some people 
   very unhappy.

I still plan to respond to some of the discussion of MI that's
happened of late but I may not get to it until the weekend.  I thought
I'd throw this idea out for comic relief, if nothing else.