Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Safe Obj.magic container ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-28 (15:29)
From: David Teller <David.Teller@u...>
Subject: Re: [Caml-list] Safe Obj.magic container ?
Interesting. Can I assume that, if my type is boxed (in this case, a
polymorphic variant), I can successfully convert it to Obj.t and back ?


On Thu, 2008-02-28 at 15:23 +0100, Damien Doligez wrote:
> If that was the whole story, Obj.magic would be pretty safe.  But
> there are exceptions to the uniform representation of values, and
> they make Obj.magic really hard to use.
> The most important exception is floating-point numbers.  They are
> not always represented as one word each, and that means even
> Obj.repr is unsafe.

David Teller
 Security of Distributed Systems
 Angry researcher: French Universities need reforms, but the LRU act brings liquidations.