[m-rev.] for test and review: class inheritance

Julien Fischer jfischer at opturion.com
Thu Oct 19 17:06:08 AEDT 2017


On Thu, 19 Oct 2017, Zoltan Somogyi wrote:

> For review by Julien, who I am also asking to bootcheck this
> in the C# and Java grades. (oracle1 didn't let me do so myself;
> I got an error about the device being full.)

...

> Encode invariants about class inheritance in types.
> 
> compiler/mlds.m:
>     Make mlds_interface_id its own type, instead of identifying all
>     interfaces by an MLDS type using the mlds_class_type/3 data constructors.
>
>     Make mlds_class_id its own type, instead of identifying (almost all)
>     classes by an MLDS type using the mlds_class_type/3 data constructors.
>
>     Change the field of mlds_class_defns that says what base classes the
>     class inherits from to reflect the facts that
>
>     - the "classes" representing environments that we put on the heap
>       when targeting C# or Java have a base *type*, not a base *class*, and
>
>     - no current MLDS target language supports multiple inheritance,
>       so an MLDS class cannot inherit from more than one base class.

I would be suprised if we used it, even for a target language that did
suport it.

>     Change the mlds_class_type data constructor of the mlds_type type
>     to take a complete mlds_class_id as an argument, instead of its pieces.
> 
> compiler/ml_accurate_gc.m:
> compiler/ml_code_util.m:
> compiler/ml_elim_nested.m:
> compiler/ml_global_data.m:
> compiler/ml_lookup_switch.m:
> compiler/ml_rename_classes.m:
> compiler/ml_simplify_switch.m:
> compiler/ml_type_gen.m:
> compiler/ml_unify_gen.m:
> compiler/mlds_to_c.m:
> compiler/mlds_to_cs.m:
> compiler/mlds_to_java.m:
>     Conform to the changes above.

That looks fine. I've tested it with both the C# and Java backends
and it's fine.  (I did find a bug in one of my earlier changes
but that's a different matter ...)

Julien.


More information about the reviews mailing list