Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Nested classes and types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeremy Fincher <fincher.8@o...>
Subject: Re: [Caml-list] Nested classes and types
You have to use the "parameterization trick" since syntax doesn't work.

> Example :
> 
>   class type c_foo =
>   object
>     val val_foo : t_foo
>   end
> and
>   t_foo = Foo of c_foo

type 'a _t_foo = Foo of 'a

class type c_foo =
  object
    val val_foo : c_foo _t_foo
  end

type t_foo = c_foo _t_foo

That'll get you a type t_foo that does what you want.

Jeremy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr