From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id B09DBBB81 for ; Mon, 3 Jan 2005 12:06:43 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j03B6hOQ005218 for ; Mon, 3 Jan 2005 12:06:43 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA30388 for ; Mon, 3 Jan 2005 12:06:43 +0100 (MET) Received: from smtp002.mail.ukl.yahoo.com (smtp002.mail.ukl.yahoo.com [217.12.11.33]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id j03B6gST005215 for ; Mon, 3 Jan 2005 12:06:42 +0100 Received: from unknown (HELO ?10.0.0.115?) (pasckosky@213.255.109.130 with plain) by smtp002.mail.ukl.yahoo.com with SMTP; 3 Jan 2005 11:06:42 -0000 Message-ID: <41D92741.5010600@yahoo.it> Date: Mon, 03 Jan 2005 12:06:41 +0100 From: Luca Pascali User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5 X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] string_of_polymorphic References: <41D915E0.4030701@yahoo.it> <200501031018.47703.jon@jdh30.plus.com> <41D9211D.7060003@yahoo.it> <200501031100.27306.jon@jdh30.plus.com> In-Reply-To: <200501031100.27306.jon@jdh30.plus.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at nez-perce with ID 41D92743.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41D92742.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 marshalling:01 hash:01 hash:01 run-time:01 cheers:01 ocaml:01 baretta:01 baretta:01 ...:98 polymorphic:01 polymorphic:01 marshal:01 marshal:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.5 required=5.0 tests=FROM_ENDS_IN_NUMS autolearn=disabled version=3.0.0 X-Spam-Level: Jon Harrop wrote: > [...] > >I believe that the name of a polymorphic variant, as a string, is not in the >marshalled string. Instead, the name is in the type, which is not conveyed by >marshalling. I think the marshalled string will actually contain a fixed-size >hash of the string name. > >In theory, two polymorphic variant names which produce the same hash should be >indistinguishable at run-time. Producing them will be tricky though. > >A consequence of this is the fixed-size (1-word) of a marshalled polymorphic >variant: > ># Marshal.to_string `dkdfbgkadjfbgljbfgljkabhvlkjblvbalvbvlabalbvaslbk [];; >- : string = >"\132\149¦¾\000\000\000\005\000\000\000\000\000\000\000\000\000\000\000\000\002í\014âí" ># Marshal.to_string `abcd [];; >- : string = >"\132\149¦¾\000\000\000\005\000\000\000\000\000\000\000\000\000\000\000\000\002ÀheÂ" > >Cheers, >Jon. > > > Ok, anyway I already dropped the way of analisis of marshalled string, because I don't even know if it is always done in the same way across platforms and ocaml versions. Tkanks. I will probably insert in a tuple a string with the name of the construtor. Luca -- ********************************************************************* Luca Pascali luca@barettadeit.com asxcaml-guru@barettadeit.com http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. 02 370 111 55 fax. 02 370 111 54 Our technology: http://www.asxcaml.org/ http://www.freerp.org/