[m-users.] Comparison in the reference manual

Julien Fischer jfischer at opturion.com
Mon Nov 9 10:50:33 AEDT 2015


On Mon, 9 Nov 2015, Peter Wang wrote:

> On Mon, 9 Nov 2015 10:09:27 +1100, Paul Bone <paul at bone.id.au> wrote:
>> 
>> While answering a question on IRC I tried to find the relevant part in the
>> reference manual for comparison.  Specifically that the order of functors in
>> a type declaration is significant.  But I could not find it.
>> 
>> Is this written down somewhere?
>
> Hi Paul,
>
> Only implicitly, as far as I am aware.

It's written down in compiler/unify_proc.m, but that's not really
something you should be pointing users at.  ;-)

> Under "Using foreign enumerations in Mercury code" it states:
>
>   Note that the default comparison for types that are the subject of a
> `pragma foreign_enum' declaration will be defined by the foreign
> values, rather than the order of the constructors in the type
> declaration (as is usually the case).
>
> In README.Erlang I wrote:
>
> * Discriminated union values are ordered according to Erlang conventions
>  (e.g. alphabetically) instead of according to the order that data
>  constructors appear in the type definition.
>
> I think the standard ordering should be described in the chapter on
> discriminated unions.

Agreed.  (I remember looking for such a section when I wrote the
reference manual section on foreign enumerations.)

Julien.



More information about the users mailing list