caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Andreas Rossberg <rossberg@ps.uni-sb.de>
Cc: OCAML <caml-list@inria.fr>
Subject: Re: [Caml-list] illegal permutation of structure fields?
Date: Thu, 26 Jul 2001 09:14:46 +0200	[thread overview]
Message-ID: <20010726091446.A17748@pauillac.inria.fr> (raw)
In-Reply-To: <3B5C4BB0.70D3B74B@ps.uni-sb.de>; from rossberg@ps.uni-sb.de on Mon, Jul 23, 2001 at 06:07:12PM +0200

> Then the followup question of course is: isn't it trivial to use a
> canonical layout instead, where the tuple components are sorted wrt. to
> the corresponding fields' label? This way layout is invariant wrt
> permutation in signatures. Or is there a particular problem with such a
> scheme?

It seems possible to proceed this way; I was just explaining that this
is not the way it's currently done in OCaml.

In other words, I read Markus' question as "why not compare module
types after sorting their components?", and replied to that question,
but maybe he meant "why not determine the memory layout of structures
after sorting their components?".  In the latter case, the answer is
that it could probably be done, but I see no real strong need for this
(see below).

> (BTW, the same holds for record and variant types, where Ocaml does not
> allow reordering of fields/constructors either.)

Yes, but would this be really useful?  Manifest type declarations and
manifest module types in signatures must be implemented by the same
type/module type declaration in the matching structure.  This is
generally done by generous cut&paste between the signature and the
structure.  What would we gain by allowing reordering fields,
constructors or module type components?  Except making it harder for
the programmer to spot mismatches between the two declarations...

- Xavier Leroy
-------------------
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-26  7:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 13:04 Markus Mottl
2001-07-23 15:27 ` Xavier Leroy
2001-07-23 16:07   ` Andreas Rossberg
2001-07-26  7:14     ` Xavier Leroy [this message]
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=20010726091446.A17748@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=rossberg@ps.uni-sb.de \
    /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).