Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Francois Pottier <Francois.Pottier@inria.fr>
To: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
Cc: caml-list@inria.fr
Subject: Re: Weird behavior with mutually recursive type definitions
Date: Mon, 16 Aug 1999 08:31:58 +0200	[thread overview]
Message-ID: <19990816083158.52649@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


> Why is it so? Constraints are required for the object system, and if
> there are constraints you must expand abbreviations inside definitions
> to check them.  If recursion occurs before the abbreviation is
> generalized, this means that all occurences of an abbreviation in the
> same type definition will be unified, and have the same constraints.

I fail to see why type abbreviations should be monomorphic while
their declaration is being checked. Is this intended to make the
type system safe, or to guarantee the typechecker's termination?

By the way, I find O'Caml's error messages on this topic rather
strange. If I try:

  type 'a t = ('a -> 'a) u
  and 'a u = ('a -> 'a) t

then I obtain

  This type ('a -> 'a) -> 'a -> 'a should be an instance of type 'a

which corresponds to the problem discussed so far. This seems to
indicate that t and u are understood as mutually recursive type
abbreviations. However, if I try:

  type t = u and u = t

then O'Caml answers

  A type variable is unbound in this type declaration

which surprises me. I would rather expect to be warned about
cyclic type abbreviations.

-- 
François Pottier
Francois.Pottier@inria.fr
http://pauillac.inria.fr/~fpottier/




  reply	other threads:[~1999-08-22 18:17 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 [this message]
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

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=19990816083158.52649@pauillac.inria.fr \
    --to=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