From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q3CE3mNm006863 for ; Thu, 12 Apr 2012 16:03:49 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtYBAK/fhk/B/BfUkWdsb2JhbABEgxyzSYMkAQEBAQkLCwcUAySCCQEBBAE4QAEFCwsSBgkWDwkDAgECATcOBg0BBwEBiAUJuwqRfgSVbIVyjS0 X-IronPort-AV: E=Sophos;i="4.75,410,1330902000"; d="scan'208";a="153744359" Received: from msa03.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.212]) by mail1-smtp-roc.national.inria.fr with ESMTP; 12 Apr 2012 16:03:43 +0200 Received: from [192.168.1.105] ([86.195.143.161]) by mwinf5d28 with ME id x23i1i00H3V8rWW0323ifq; Thu, 12 Apr 2012 16:03:43 +0200 Message-ID: <4F86E0C0.8020003@frisch.fr> Date: Thu, 12 Apr 2012 16:03:44 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Gabriel Scherer CC: Leo P White , caml References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] [ANN] ocamlopen 1.0.2 I'll let Leo answer all your questions. Here are just my 2 cents: On 04/12/2012 02:56 PM, Gabriel Scherer wrote: > 3. What is the semantics of making a *constructor* private? I guess the idea is to allow pattern matching on that constructor, but not using it in positive position (to construct a value). > 4. When would you say that one should use polymorphic variants rather > than your open datatypes? (I know how to argue in the other direction: > unique constructors make for better error messages.) I've wanted such open datatypes several times. One example is a message bus across an application: some components can yield messages to be dispatched to all registered components. Messages can hold data, and the set of possible messages (with the type of their associated data) is extensible (say, because components can be loaded dynamically, or just to make the application's architecture more modular). It makes sense to use an extensible datatype to represent messages. Components can react to messages with pattern-matching and two components can interact if their share a common constructor definition. This is simpler than encoding open datatypes with a "universal" type (with injections/projections). Of course, one can use the existing "exn" type, but then we don't distinguish between exceptions and messages at all. Alain