From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 69D31BC57 for ; Thu, 5 Aug 2010 18:17:22 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuYBAJ6AWkzB/BfTkWdsb2JhbACgTgEBAQEJCwoHEQMfxwiFOgSJLA X-IronPort-AV: E=Sophos;i="4.55,323,1278280800"; d="scan'208";a="55134822" Received: from msa02.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.211]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Aug 2010 18:17:22 +0200 Received: from [192.168.1.90] ([83.199.87.87]) by mwinf5c05 with ME id qgHL1e0241t47Lr01gHLAV; Thu, 05 Aug 2010 18:17:21 +0200 Message-ID: <4C5AE415.8070604@frisch.fr> Date: Thu, 05 Aug 2010 18:17:25 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: Philippe Veber Cc: Dario Teixeira , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Emulating width subtyping with 1st-class modules References: <607998.18398.qm@web111514.mail.gq1.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 subtyping:01 marshaled:01 marshaling:01 simulate:01 closures:01 wrote:01 signatures:01 typing:01 caml-list:01 marshal:01 alain:01 alain:01 data:02 On 08/05/2010 06:10 PM, Philippe Veber wrote: > I have a related question: the only reason why i'm not fully happy with > objects used as anonymous records is that i sometimes use them as mere > data containers and need to save (marshal) them at some point. Which is > not permitted as soon as you want to exchange marshalled values between > two different programs. Hopefully one can rely on json-static to cope > with that limitation in a quite elegant way. Are first-class modules > distinct in that respect ? That is, can they be marshalled if they do > not contain closures ? Yes, they can be marshaled. As usual with marshaling, you don't get any type safety. That said, first-class modules cannot really be used to simulate anonymous records since they rely on nominal typing: even if S and S' refer to identical signatures, the types (module S) and (module S') are not equal. Alain