Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jerome Vouillon <Jerome.Vouillon@inria.fr>
To: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>,
	Francois.Pottier@inria.fr
Cc: caml-list@inria.fr
Subject: Re: Weird behavior with mutually recursive type definitions
Date: Fri, 27 Aug 1999 12:12:54 +0200	[thread overview]
Message-ID: <19990827121254.36255@pauillac.inria.fr> (raw)
In-Reply-To: <19990813104206X.garrigue@kurims.kyoto-u.ac.jp>; from Jacques GARRIGUE on Fri, Aug 13, 1999 at 10:42:06AM +0900

On Fri, Aug 13, 1999 at 10:42:06AM +0900, Jacques GARRIGUE wrote:
> I personnaly think that, like for polymorphic recursion, the semantics
> could be changed so that the user has to write explicitely the
> constraints. In type definitions, this makes sense. If a constraint
> appears to be needed somewhere and was not declared, there would be an
> error.  Technically this would probably mean doing two passes on type
> definitions: one to introduce definitions (polymorphically) and one to
> check the constraints. In such a way, one could avoid this strange
> side-effect of the object system on the rest of the language.
> 
> Comments, Jerome ?

This would indeed be much less confusing.  It is not clear to me how
this can be done, though.

An alternative would be that the compiler automatically sorts the type
definitions so as to eliminate as much mutual recursion as possible.
Then, all correct type abbreviations could be defined using mutually
recursive type definitions and the user would not have to reorder
manually the definitions.

Type representations are already typed after the type abbreviations
have been computed, which explains why the following definition is
accepted:
  type 'a t = 'a and u = A of int t and v = B of bool t;;

-- Jérôme




      parent reply	other threads:[~1999-08-30  8:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-04 13:52 Francois Pottier
1999-08-12 13:17 ` Hendrik Tews
1999-08-13  1:42 ` Jacques GARRIGUE
1999-08-16  6:31   ` Francois Pottier
1999-08-16  7:08     ` Jacques GARRIGUE
1999-08-16  7:51       ` More confusion " Francois Pottier
1999-08-16  7:57         ` Jacques GARRIGUE
1999-08-27 11:32     ` Weird behavior " Jerome Vouillon
1999-08-27 10:12   ` Jerome Vouillon [this message]

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=19990827121254.36255@pauillac.inria.fr \
    --to=jerome.vouillon@inria.fr \
    --cc=Francois.Pottier@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /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