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
[Caml-list] Programming with modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Baptiste Rouquier <jrouquiethearchiveshouldhaveafewantispamtricks@e...>
Subject: [Caml-list] Programming with classes
Quoting skaller:
>There is a further step: constructors. Never export
>class constructors. They must be wrapped in a normal
>Ocaml function which returns an abstract class type.

I would be glad to follow this rule, since I'm experiencing aesthetical problems
with constructors (see below). But could you develop a bit on this ?

My problem is that I'm exporting many class constructors (if you explain me why
I shouldnt, the next version probably won't) with similar argument types :
class type ['a] foo = object ... end
class foo_int : int -> string -> [int] foo
class foo_float : float -> string -> [float] foo
class ['a] foo_option : 'a wrappers -> 'a option -> string -> ['a option] foo

The actual class constructors have more arguments, so I'd like to define a sort
of polymorphic class specification and then avoid to repeat the arguments. The
aim is to have clearer documentation. I was considering wrapping it all into
functions but it's pure stub code.
Suggestions ?

Jean-Baptiste Rouquier

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: