Hello ocamlers,
the following behavior puzzle me. The typing of this fragment:
class virtual ['a, 'b] a = object end
class virtual ['b] b =
object
inherit ['b, 'b] a
end
gives
class virtual ['a, 'b] a : object end
class virtual ['a] b : object end
but the the following code:
class virtual ['a, 'b] a = object end
and virtual ['b] b =
object
inherit ['b, 'b] a
end
returns
class virtual ['a, +'b] a : object constraint 'b = 'a end
and virtual ['a] b : object end
I don't understand why a constraint is added. The difference between the
two fragments is that the declaration of class b is in the same "scope"
as class a.
Anyway, my initial problem is to define two recursive classes (because
methods in one refers to object of the other class and vice versa). But
I should avoid the collapse of the two type parameters (more precisely,
I have 4 type parameters and 3 classes that make some permutation
between them). Any idea ?
Thank you,
Jean-Louis Giavitto.
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs