[m-rev.] for review: module_add_type_defn

Julien Fischer jfischer at opturion.com
Wed Jun 28 15:00:10 AEST 2017


Hi Zoltan,

On Wed, 28 Jun 2017, Zoltan Somogyi wrote:

> On Tue, 27 Jun 2017 23:05:18 +1000 (AEST), Julien Fischer <jfischer at opturion.com>
>>> Foreign MergedBody
>>
>> ?
>
> Sorry, that was just a stale reminder to myself.
>
>>> Make the code adding new types to the HLDS readable.
>>>
>>> The motivation for this diff was that I wanted the compiler to generate
>>> a warning if a module declared the same type twice. (During the cleanup
>>> of unify_proc.m I did recently, I found and fixed such a duplicate
>>> declaration.)
>>
>> The diff looks fine.
>
> Thanks for the review.
>
> Do you (or anyone else) have any opinions on the issues marked by XXXs in the
> affected code, old and new? For example, the attached program compiles just fine
> both before and after this diff, but I think that the definitions of foo1 and foo2
> should both get an error, and one of rafe's old comments says that foo3 should
> get one too.

Every type in the attached program should should result in an error.
All three types are declared as solver types but (1) the definitions
lack the 'solver' keyword and (2) they also lack the 'representation'
attribute which is mandatory for all solver types (See the "Solver type
definitions" section of the reference manual).

> And should it be an error to declare (not define) a type in both
> the interface and the implementation section of a module?

It's an error for predicate declarations, so I suppose for consistency
it ought to be for types as well.  (Note that typeclass and instance
declarations in both the interface and implementation are also both
also currently allowed.)

Julien.





>
> Zoltan.
>
>


More information about the reviews mailing list