From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: rich@annexia.org
Cc: rathereasy@gmail.com, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] ocamlc freezes
Date: Mon, 12 May 2008 22:37:43 +0900 (JST) [thread overview]
Message-ID: <20080512.223743.52176750.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <20080512083745.GA23048@annexia.org>
From: Richard Jones <rich@annexia.org>
> On Sun, May 11, 2008 at 09:19:26PM -0400, Jacques Le Normand wrote:
> > hello caml-list
> > when I try to compile
> >
> > class type node =
> > object
> > method get_right_sibling : node option
> > end
> > class type ['top_parent_type,'left_sibling_type,'right_sibling_type] typ =
> > object
> > inherit node
> > method get_left_sibling : 'left_sibling_type option
> > method get_right_sibling : 'right_sibling_type option
> > end
> > type 'p foo_typ = ('p,'p foo_typ,'p foo_typ) typ
> >
> > with
> >
> > ocamlc test.ml
> >
> > ocamlc just freezes; I'm using ocaml 3.09.2 on ubuntu. What should I do?
>
> Possibly upgrade. With 3.10.0 this gives an error:
>
> File "test.ml", line 11, characters 4-48:
> This type constructor expands to type
> 'a foo_typ =
> < get_left_sibling : 'a foo_typ option; get_right_sibling : node option >
> but is here used with type node = < get_right_sibling : node option >
> Type node = < get_right_sibling : node option > is not compatible with type
> < get_right_sibling : node option >
> Type
> 'a foo_typ =
> < get_left_sibling : 'a foo_typ option; get_right_sibling : node option >
> is not compatible with type
> < get_left_sibling : 'a foo_typ option; get_right_sibling : node option >
> Types for method get_left_sibling are incompatible
This probably requires a bit of explanation, as the error message
seems to tell that identical types are not so... maybe a bug in the
reporting code.
Anyway, this is the first line that matters.
You cannot change a method's type with method override.
So get_right_sibling in typ has still type [node option], which means
that in foo_typ, ['p foo_typ] should be a [node option], hence the
contradiction.
There was a type-checker bug in 3.09.2, but it is now fixed.
Cheers,
Jacques Garrigue
prev parent reply other threads:[~2008-05-12 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-12 1:19 Jacques Le Normand
2008-05-12 8:37 ` [Caml-list] " Richard Jones
2008-05-12 13:37 ` Jacques Garrigue [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=20080512.223743.52176750.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@yquem.inria.fr \
--cc=rathereasy@gmail.com \
--cc=rich@annexia.org \
/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