On 10 May 2012, at 14:22, Yitzhak Mandelbaum wrote:

> Is there any "common wisdom" regarding the inclusion of optional functions in 
> a module signature?  The two most obvious approaches involve 1) a pair of 
> boolean flag and a function, where the function raises an exception if 
> unimplemented OR 2) using the option type. I see pros/cons to each approach, 
> but am curious if there's any (unofficial) standard approach.
> 

I strongly favor option types over exceptions; in this case I would go for the 
option type and make the whole function "optional", not just its return type; 
e.g.:

module MYSIG : sig
  ...
  val f : (int -> int -> int) option
end


best regards

-Markus

-- 
Markus Weißmann, M.Sc.
Technische Universität München
Institut für Informatik
Boltzmannstr. 3
D-85748 Garching
Germany
http://wwwknoll.in.tum.de/



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