Re: Tree of a certain class:

From: Pierre Boulet (Pierre.Boulet@lifl.fr)
Date: Fri Sep 24 1999 - 14:06:44 MET DST


To: peter.schrammel@gmx.de
Subject: Re: Tree of a certain class:
From: Pierre Boulet <Pierre.Boulet@lifl.fr>
In-Reply-To: Peter Schrammel's message of "Fri, 24 Sep 1999 10:15:52 +0200"
Date: 24 Sep 1999 14:06:44 +0200

> 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.



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET