Hi,

When I try to compile the following code:

class a =
object
  method f (x:[>]) = ()
end

I get the following error:

Error: Some type variables are unbound in this type:
         class a : object method f : [>  ] -> unit end
       The method f has type ([>  ] as 'a) -> unit where 'a is unbound

Is the binding of [>] to 'a really necessary here? In particular it is
not mentioned in the inferred type...

Of course I can parametrize the class over 'a as

class ['a] a =
object
  method f (x:[>] as 'a) = ()
end

which now has type

class ['a] a : object constraint 'a = [>  ] method f : 'a -> unit end

But this seems rather cumbersome. Is there a way to handle this without
mentioning 'a?

Thanks!

Cheers,

Samuel.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to