Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2008-03-03 (10:20)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] OO programming
From: "Tiphaine.Turpin" <>

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