I would personally use an [option] and a form of startup-time
configuration, quite comparable to the browser-feature detection in
JavaScript.

So, something like

let my_function = match Module.may_have_feature with
  | Some implementation -> implementation
  | None -> (*either a workaround or an error*)

Cheers,
 David

On 5/10/12 4:53 PM, Fabrice Le Fessant wrote:
> 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
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to