[m-users.] Comparison in the reference manual

Peter Wang novalazy at gmail.com
Mon Nov 9 10:23:19 AEDT 2015


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.

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.

Peter



More information about the users mailing list