> And if you don't want to pollute your entire code with functor when
> it's in fact for testing and not part of the logic of the application,

Functor seams the way to go here.
The use of this technique as envisaged here is hardly invading, and comes with 
many advantages :

Functors help document/clarify the code by stating the relasionships between 
modules.

Functors help build testable programs by encouraging small and well isolated 
modules.

Functors help build testable programs by allowing to replace a module with the 
test version of the modules (the same with many more pre/post conditions added).

And they come free from runtime cost most of the time, which is amazing.

For some reasons though, despite functors being one of the greatest strength of 
the language, we do seam shy to use, recommand or brag about them. I wonder if 
this is due to the lack of proper documentation ?

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to