Hello, I am attempting to learn oCaml and am having an issue as to why the below program is invalid.
class myClass2 =
object
method doSomething = Printf.printf "%s\n" "Doing something"
end;;
class myClass foo =
object
val dMember = foo
method doIt = dMember#doSomething
end;;
let mc2 = new myClass2;;
let mc = new myClass mc2;;
mc#doIt;;
The error I receive when trying to compile the program is:
File "sample.ml", line 6, characters 5-84:
Some type variables are unbound in this type:
class myClass :
(< doSomething : 'b; .. > as 'a) ->
object val dMember : 'a method doIt : 'b end
The method doIt has type 'a where 'a is unbound
I am particularly interested as to why:
val dMember = foo
method doIt = dMember#doSomething
is invalid. Any (and I mean any) help is appreciated.