[
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: | Michael Wohlwend <micha-1@f...> |
| Subject: | ocamlc throws exception |
that code :
-----------------------------------------------
class ['a] nil = object(self:'a)
method next = self
method set_next n = ()
method apply (f:'a -> unit) (upto:'a) = ()
end;;
class ['a] node = object(self:'a)
constraint 'a = 'a #nil (* line 10 *)
inherit ['a] nil
val mutable next = new nil
method set_next n = next <- n
method apply f upto =
f self; if self <> upto then self#next#apply f upto
end;;
let a = new node;;
-----------------------------------------
causes this exception:
Fatal error: exception Ctype.Unify(_, 0)
(Program not linked with -g, cannot print stack backtrace)
without line 10 it compiles, allthough I get this error-message:
The type of this expression,
< apply : ('a -> unit) -> 'a -> unit; next : 'a;
set_next : (< apply : ('b -> unit) -> 'b -> unit; next : 'b;
set_next : '_c -> unit >
as 'b) ->
unit >
as 'a, contains type variables that cannot be generalized
is the exception o.k. ? I know now that the contstraint statement is wrong and
sensless here...
Michael