I'm trying to create a polymorphic class 'a foo which has a
polymorphic method that takes as a parameter another foo object, but
one with arbitrary type. In other words, something like this:
class virtual ['a] foo =
object (self)
method virtual bar : 'b. 'b foo -> unit
end;;
When I try to compile this, though, I get a warning that I "cannot
quantify 'b because it escapes this scope". When I drop the " 'b. " it
compiles fine, but the reported type for bar is 'a foo -> unit; i.e.
it's no longer polymorphic.
Is there a problem with trying to make a method polymorphic with
respect to the class type in this way? How can I make this work?
.