Browse thread
string_of_polymorphic
-
Luca Pascali
-
Jon Harrop
- Luca Pascali
- Luca Pascali
- pad@r...
- Alex Baretta
-
Jon Harrop
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-01-03 (11:06) |
From: | Luca Pascali <pasckosky2000@y...> |
Subject: | Re: [Caml-list] string_of_polymorphic |
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/