Version française
Home     About     Download     Resources     Contact us    
Browse thread
OO programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] OO programming
From: "Tiphaine.Turpin" <Tiphaine.Turpin@free.fr>

> I don't know if there is an equivalent to inherit for 
> polymorphic variants: "type t' = private  [> t | ...] doesn't seem to 
> work. And using objects to encode variants is possible, but you may be 
> used to more serious solutions...

It's actually simple with polymorphic variants than with objects.
You just write
    type t' = private [> t ]
but t has to be a non-private polymorphic variant type.
So you have to maintain a hierarchy of non-private types, to be
able to build your private types. This should be already apparent in
my code for event.

Jacques