From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q4AED8an032409 for ; Thu, 10 May 2012 16:13:09 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsYBAGDMq0+DnwAImWdsb2JhbABEDrN9IgEBAQEBCAsLBxQnghUBAQQBJ1IFCwtGVwaIHAW7SYsShUZjBJcOkV87 X-IronPort-AV: E=Sophos;i="4.75,565,1330902000"; d="scan'208";a="143349084" Received: from mail-out1.informatik.tu-muenchen.de ([131.159.0.8]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 10 May 2012 16:13:06 +0200 Received: from lapknoll93.informatik.tu-muenchen.de (lapknoll93.informatik.tu-muenchen.de [131.159.61.48]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.in.tum.de (Postfix) with ESMTPSA id 7CA34240583; Thu, 10 May 2012 16:13:05 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=iso-8859-1 From: =?iso-8859-1?Q?=22Markus_W=2E_Wei=DFmann=22?= In-Reply-To: Date: Thu, 10 May 2012 16:13:05 +0200 Cc: OCaml mailing list Message-Id: References: To: Yitzhak Mandelbaum X-Mailer: Apple Mail (2.1257) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q4AED8an032409 Subject: Re: [Caml-list] optional functions in modules 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/