I would say that it depends on how likely it is that somebody is going
to handle the case where the function is not implemented. I would use
a boolean to detect if the function is implemented, and calling the
missing function would raise an exception (be careful to define the
corresponding exception, using failwith "not implemented" might be too
generic to be useful, although I always do it in my programs ;-) ). If
it is highly likely that the program is going to handle the missing
function, using a Some type for the function is better idea.

-Fabrice

On Thu, May 10, 2012 at 2:22 PM, Yitzhak Mandelbaum
<yitzh...@cs.princeton.edu> wrote:
> Hi,
>
> 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.
>
> Yitzhak
> -----------------------------
> Yitzhak Mandelbaum
>
>
>
>
>
> --
> 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
>



-- 
Fabrice LE FESSANT


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