[Grace-core] Multiple inheritance & module inheritance

Michael Homer mwh at ecs.vuw.ac.nz
Mon Mar 9 17:03:05 PDT 2015


On Tue, Mar 10, 2015 at 12:17 PM, Andrew P Black
<andrew.p.black at gmail.com> wrote:
> 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?
foo could have been overridden. Tim has raised this issue before.

The quoted version was incomplete and there is a more finished version
at that URL now.
-Michael


More information about the Grace-core mailing list