Version française
Home     About     Download     Resources     Contact us    
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 ?


Thanks,
-- 
Jean-Baptiste Rouquier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners