[Grace-core] Multiple inheritance & module inheritance

Andrew P Black andrew.p.black at gmail.com
Mon Mar 9 16:17:08 PDT 2015


Michael's example of the type issues (from http://homepages.ecs.vuw.ac.nz/~mwh/types.txt)

> class foo.new {
>     type A = {
>         x -> A
>     }
>     method hello(a : A) {}
>     hello(...)
> }
> class bar.new {
>     inherits foo.new
>     type B = {
>         x -> A
>     }
>     method hello(b : B) {}
> }
> 
> The "hello" method must be attached to the object at the
> start, including its type annotation B. B relies on A. A is
> in foo and must be inherited. Inheriting foo executes
> "hello", which will be the overridden version.

This seems to me to illustrate nicely why thinking about inheritance as a dynamic operation is not the right approach.   Both A and B are well-defined and not changed by inheritance.  So why is this code problematic, from a sematic perspective?

Maybe Michael didn't intend for A and B to be synonyms?  Even if they are not, I still don't see a problem.  Sure, the current implementation in minigrace doesn't handle this, but that's true for a lot of things!  

	Andrew




More information about the Grace-core mailing list