[
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: | Samuel Mimram <samuel.mimram@e...> |
| Subject: | Objects and variants |
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.