[m-dev.] mini types
novalazy at gmail.com
Mon Jun 1 16:08:34 AEST 2020
On Mon, 01 Jun 2020 15:26:19 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> 2020-06-01 14:04 GMT+10:00 Peter Wang<novalazy at gmail.com>:
> >> It would be required on t3. Unless we reserve "bool" so that it can
> >> *only* refer to the bool defined in the Mercury standard library,
> >> which neither of us seems to like, it would be required for bool as well.
> > Can you explain why it would be required on bool? I understand from
> > your other message that for a simple type like bool, the compiler will
> > (still) include type representation information into the .int3 file,
> > which would be available when it comes time to verify the type_size
> > assertion on t3.
> If the module (say A) imports bool, then the compiler
> - will not read bool.int3, or any other .int3 file, when generating A.int3, but
> - will read bool.int3, and the .int3 files of the other modules A imports,
> when generating A.int and A.int2 (mmc --make-interface A.m generates
> We would need the information about bool's size when generating A.int3.
> This means we *can't* get it from bool.int3 at that time. We *could* get it
> from a pragma, and the compiler could verify that the pragma does not lie
> when generating A.int.
And that pragma for bool needs to be in module A? Ok.
However, this is what I had in mind:
- while generating bool.int3, the compiler includes information about
bool's size into bool.int3
- while generating A.int3, the compiler blindly copies any type_size
assertions (which must be for types defined in A) into A.int3.
It does not need to read in any .int3 files.
- while generating A.int and A.int2, the compiler verifies the type_size
assertions in A.m. It can use the information about bool's size from
bool.int3, as well as other information from the .int3 files of any
module A imports.
More information about the developers