From: "\"Markus W. Weißmann\"" <markus.weissmann@in.tum.de>
To: Yitzhak Mandelbaum <yitzhakm@CS.Princeton.EDU>
Cc: OCaml mailing list <caml-list@inria.fr>
Subject: Re: [Caml-list] optional functions in modules
Date: Thu, 10 May 2012 16:13:05 +0200 [thread overview]
Message-ID: <B3E9B86E-B7D8-48D9-9380-604D4B90E048@in.tum.de> (raw)
In-Reply-To: <F3D7441E-ABE9-46D5-ABA5-FC47D3EA7E0E@cs.princeton.edu>
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/
next prev parent reply other threads:[~2012-05-10 14:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 12:22 Yitzhak Mandelbaum
2012-05-10 14:13 ` "Markus W. Weißmann" [this message]
2012-05-10 14:53 ` Fabrice Le Fessant
2012-05-10 14:59 ` David Rajchenbach-Teller
2012-05-10 18:44 ` Goswin von Brederlow
2012-05-11 0:55 ` Yaron Minsky
2012-05-17 17:43 ` Yitzhak Mandelbaum
2012-05-18 15:24 ` David Rajchenbach-Teller
2012-05-18 16:00 ` Gabriel Scherer
2012-05-18 20:05 ` Nicolas Braud-Santoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B3E9B86E-B7D8-48D9-9380-604D4B90E048@in.tum.de \
--to=markus.weissmann@in.tum.de \
--cc=caml-list@inria.fr \
--cc=yitzhakm@CS.Princeton.EDU \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox