[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] ocamlc freezes |
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