[m-dev.] for review: MR_TypeInfo cleanup, part 1

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Mar 24 21:24:53 AEDT 2000


On 24-Mar-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> What does MR_TYPECTOR_REP_EQUIV_VAR represent?
> The definition of that enum in runtime/mercury_type_info.h
> does not document what the different alternatives are supposed
> to mean.

It used to mean that the type in question was an equivalence type where
the RHS is a type variable, like this:

:- type t1(T) == T.

The new RTTI system never generates such type_ctor_reps; it generates
plain MR_TYPECTOR_REP_EQUIV instead. There is no point at the moment
in generating a special type_ctor_rep for such types; they are rare,
and the processing required from them is not substantially different
from other non-ground equivalence types. The tiny bit of optimization
that would be possible by not calling the general purpose routines for
expanding the pseudo typeinfo of the RHS type would be counterbalanced
by the need to export details of the type variable substitution algorithm
to parts of the system other than mercury_type_info.c and its include file.

> >                  /*
> >                  ** The current version of the RTTI gives all equivalence types
> >                  ** the EQUIV type_ctor_rep, not EQUIV_VAR.
> >                  */
> >                  fatal_error(""unexpected EQUIV_VAR type_ctor_rep"");
> 
> Ah, I see it is documented here.
> It would be nice to have the same documentation at the
> other places that call fatal_error() for MR_TYPECTOR_REP_EQUIV_VAR.
> 
> BTW, is that documentation correct?
> Doesn't the current version sometimes give EQUIV_GROUND
> rather than EQUIV?

It should say "... all *such* types ..."

Zoltan.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list