[m-dev.] question about types with no definitions

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Sep 20 13:15:54 AEST 2019



On Fri, 20 Sep 2019 11:59:06 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:

> 
> On Fri, 20 Sep 2019, Zoltan Somogyi wrote:
> 
> > As we discussed in the last few weeks, I have been working on
> > our system of type definitions. In doing so, I found that types
> > without definitions are more common than I thought. They occur
> > in the standard library not just in modules that the compiler
> > considers builtin modules (in that it automatically imports them
> > in some circumstances), but in other modules as well, to wit,
> > type_desc.m and rtti_implementation.m. The types involved
> > (type_desc, pseudo_type_desc, type_ctor_desc, type_info,
> > pseudo_type_info and type_ctor_info) all completely lack
> > any definitions visible to the Mercury compiler, their implementations
> > being completely in foreign code.
> 
> There are definitions for type_info etc in rtti_implementation.m;
> did you mean the ones in private_builtin?

Yes.

> > I still want to generate error messages for types that
> > the source code of a module declares but does not define,
> > since this is an error in all but a tiny handful of cases like this
> > for implementors, and *all* cases for non-implementors.
> 
> Do we not already do such a check in
> compiler/check_for_missing_type_defns.m?  How is this different?

I forgot about that, even though I created that module :-(

It would be different in that the check would be carried out
when creating interface files, a long time before the HLDS
is constructed. But you are right, I can use the same strategy
as that code for deciding whether a missing definition warrants
an error message. Thanks.

Zoltan.


More information about the developers mailing list