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

On Mon, Aug 16, 1999 at 08:31:58AM +0200, Francois Pottier wrote:

> 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.

In fact, in the latter case, the abbreviations are underspecified :
the expansion of t and u could be any type. When typing this
declaration, the compiler first assumes that the type t expand to some
type variable 'a and then tries to use the equalities t = u and u = t
to refine the expansion. In this case, the expansion remains unchanged
and therefore, the compiler complains that the type t expands to an
unbound type variable 'a.

-- Jérôme




  parent reply	other threads:[~1999-08-30 13:36 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     ` Jerome Vouillon [this message]
1999-08-27 10:12   ` Weird behavior " 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=19990827133207.53446@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