Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
To: Francois Pottier <Francois.Pottier@inria.fr>
Cc: caml-list@inria.fr
Subject: Re: Weird behavior with mutually recursive type definitions
Date: Thu, 12 Aug 1999 15:17:43 +0200	[thread overview]
Message-ID: <199908121317.PAA27233@ithif20.inf.tu-dresden.de> (raw)
In-Reply-To: <19990804155239.50895@pauillac.inria.fr>


Francois Pottier writes:

   Date: Wed, 4 Aug 1999 15:52:39 +0200
   Subject: Weird behavior with mutually recursive type definitions
   
   [...]

     type 'a t = 'a dummy
      and specialized = int t
   
   O'Caml still accepts the code, but this time, it constrains 'a
   to be equal to int, as if the type constructor t could not be
   used polymorphically within its own declaration:
   
     type 'a t = 'a dummy constraint 'a = int
                          ^^^^^^^^^^^^^^^^^^^
     type specialized = int t
   
   Why is this? Can someone explain, or is it a typechecker bug?
   
A few month ago we run into the same problem. From a private
conversation with Jacques Garrigue I understood, that the above
behavior is actually a feature of the typechecker, because there
is no better solution known at the moment. :-(

We solved the problem by eliminating type abbreviations (by
replacing it with its expansion) until these constraints
vanished. (You can use option ocamlc -i on your code to see which
constraints are generated.) The elimination of the abbreviations
leads to ugly and unreadable code, but it works at least.

Hope this helps,

Hendrik




  reply	other threads:[~1999-08-12 14:51 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 [this message]
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

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=199908121317.PAA27233@ithif20.inf.tu-dresden.de \
    --to=tews@tcs.inf.tu-dresden.de \
    --cc=Francois.Pottier@inria.fr \
    --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