* ocamlc freezes
@ 2008-05-12 1:19 Jacques Le Normand
2008-05-12 8:37 ` [Caml-list] " Richard Jones
0 siblings, 1 reply; 3+ messages in thread
From: Jacques Le Normand @ 2008-05-12 1:19 UTC (permalink / raw)
To: caml-list caml-list
[-- Attachment #1: Type: text/plain, Size: 468 bytes --]
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?
[-- Attachment #2: Type: text/html, Size: 654 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] ocamlc freezes
2008-05-12 1:19 ocamlc freezes Jacques Le Normand
@ 2008-05-12 8:37 ` Richard Jones
2008-05-12 13:37 ` Jacques Garrigue
0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2008-05-12 8:37 UTC (permalink / raw)
To: Jacques Le Normand; +Cc: caml-list caml-list
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
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] ocamlc freezes
2008-05-12 8:37 ` [Caml-list] " Richard Jones
@ 2008-05-12 13:37 ` Jacques Garrigue
0 siblings, 0 replies; 3+ messages in thread
From: Jacques Garrigue @ 2008-05-12 13:37 UTC (permalink / raw)
To: rich; +Cc: rathereasy, caml-list
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-12 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-12 1:19 ocamlc freezes Jacques Le Normand
2008-05-12 8:37 ` [Caml-list] " Richard Jones
2008-05-12 13:37 ` Jacques Garrigue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox