From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 50D12BBCA for ; Wed, 27 Feb 2008 22:22:48 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAL5jxUfBMVMPkmdsb2JhbACQaAEBAQEHBAYHIpx9 X-IronPort-AV: E=Sophos;i="4.25,415,1199660400"; d="scan'208";a="8681459" Received: from kabis.univ-orleans.fr (HELO ka.univ-orleans.fr) ([193.49.83.15]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Feb 2008 22:22:48 +0100 Received: from smtps.univ-orleans.fr (localhost [127.0.0.1]) by ka.univ-orleans.fr (Postfix) with ESMTP id B1B1A12ADFF; Wed, 27 Feb 2008 22:22:47 +0100 (CET) Received: from [192.168.0.1] (lau18-1-82-246-197-195.fbx.proxad.net [82.246.197.195]) by smtps.univ-orleans.fr (Postfix) with ESMTP id 9D8B036E5B; Wed, 27 Feb 2008 22:22:51 +0100 (CET) Subject: Re: [Caml-list] Safe Obj.magic container ? From: David Teller To: Tom =?UTF-8?Q?Primo=C5=BEi=C4=8D?= Cc: Caml In-Reply-To: References: <1204103370.7718.18.camel@Blefuscu> Content-Type: text/plain; charset=utf-8 Date: Wed, 27 Feb 2008 22:22:46 +0100 Message-Id: <1204147367.7005.9.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; univ-orleans:01 0100,:01 presupposes:01 segfault:01 variants:01 pointer:01 cheers:01 univ-orleans:01 lifo:01 liquidations:98 polymorphic:01 wrote:01 caml-list:01 int:01 boolean:01 On Wed, 2008-02-27 at 12:23 +0100, Tom Primožič wrote: > The following are my experience and guesses, nothing > scientific/official/thoroughly tested: > 1. can I assume that this is always going to work if u is > 'a.'a ? > > Well, there is no type 'a.'a. You can have: > type u = { everything: 'a . 'a } That's actually what I meant. > but this presupposes that values of type u are blocks > (heap-allocated). Therefore, if you cast a boolean (true) to type u, > and then try to access the everything field of the "new" value, you > will get a segfault. Ok. > > 3. assuming the answer to 1. is No, is there a type u or a > simple > manipulation which should work for any type t ? Or perhaps > just for > polymorphic variants ? > > type u = int > this will work for any type. You can even do pointer manipulation with > it (adding and subtracting even numbers of bytes). > > Sorry everybody. Er... I can't quite figure if it's a joke. > - Tom Cheers, David -- David Teller Security of Distributed Systems http://www.univ-orleans.fr/lifo/Members/David.Teller Angry researcher: French Universities need reforms, but the LRU act brings liquidations.