Browse thread
Re: What am I missing?
-
Pierre Weis
-
Peter Schrammel
- Sylvain BOULM'E
- Pierre Boulet
- Jerome Vouillon
-
Peter Schrammel
[
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: | Pierre Boulet <Pierre.Boulet@l...> |
| Subject: | Re: Tree of a certain class: |
> class dtree =
> object
> inherit [#debug] ctree
> end
>
> But the compiler gives me the error:
>
> Some type variables are unbound in this type:
> class dtree :
> object val mutable content : (#debug as 'a) tree method get : 'a
> tree end
> The method get has type #debug tree where .. is unbound
> make: *** [test.cmo] Error 2
>
Here is a simple solution: just write your class as:
class ['a] dtree =
object
constraint 'a = #debug
inherit ['a] ctree
end
Indeed, no type variable can stay unbounded (hence the ['a]) in a
class definition. #debug (equivalent to < debug : unit; .. >) is an
abbreviation that hides a type variable (the elipsis: ..).
--
Pierre.