caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@mail4.ai.univie.ac.at>
To: OCAML <caml-list@inria.fr>
Subject: [Caml-list] illegal permutation of structure fields?
Date: Mon, 23 Jul 2001 15:04:28 +0200	[thread overview]
Message-ID: <20010723150428.B12189@chopin.ai.univie.ac.at> (raw)

Hello,

I've just found out to my surprise that the following does not work:

file: bla.ml
---------------------------------------------------------------------------
module type FOO = sig
  val x : int
  val y : int
end
---------------------------------------------------------------------------

file: bla.mli
---------------------------------------------------------------------------
module type FOO = sig
  val y : int
  val x : int
end
---------------------------------------------------------------------------

This yields the following error:

  The implementation bla.ml does not match the interface bla.cmi:
  Module type declarations do not match:
    module type FOO = sig val x : int val y : int end
  is not included in
    module type FOO = sig val y : int val x : int end
  Illegal permutation of structure fields

Why is this illegal? Wouldn't it be very straightforward to normalize
the signatures (e.g. sort elements by name) before matching them?

I knew that there is a somewhat similar restriction for record types,
which does not allow permutation of record elements in the type
definitions of implementation and interface.

In the latter case I see that without normalization there would be
problems correctly accessing record elements, but I don't quite understand
the rationale behind the first restriction.

Wouldn't normalization get rid of the problems in both cases? Or am I
overlooking anything?

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-07-23 13:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 13:04 Markus Mottl [this message]
2001-07-23 15:27 ` Xavier Leroy
2001-07-23 16:07   ` Andreas Rossberg
2001-07-26  7:14     ` Xavier Leroy
2001-07-26  8:42       ` Markus Mottl
2001-07-23 16:36   ` Markus Mottl
2001-07-25 22:27   ` John Max Skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010723150428.B12189@chopin.ai.univie.ac.at \
    --to=markus@mail4.ai.univie.ac.at \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).