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

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Sep 20 07:09:53 AEST 2019


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.

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.
(If you know enough to correctly hand-implement a Mercury
type in C, you are an implementor.) This means that
these exceptional cases have to be grandfathered in somehow.

My plan is to hardwire the list of standard library modules
that have such hand-implemented types, and disable the
must-have-a-definition checks only in those modules.
I thought about adding a ":- external_type" declaration
in parallel with ":- external_pred/func" declarations,
but I think that would be too much trouble compared
to the small effect (disabling a test for a message).
Does anyone have any objections to this plan?

Zoltan.


More information about the developers mailing list