From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 47801BB81 for ; Mon, 28 Nov 2005 09:48:47 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAS8mkHe025042 for ; Mon, 28 Nov 2005 09:48:46 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA10293 for ; Mon, 28 Nov 2005 09:48:46 +0100 (MET) Received: from smtp2-g19.free.fr (smtp2-g19.free.fr [212.27.42.28]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jAS8mj3v025039 for ; Mon, 28 Nov 2005 09:48:46 +0100 Received: from [192.168.0.4] (rke75-3-82-229-183-156.fbx.proxad.net [82.229.183.156]) by smtp2-g19.free.fr (Postfix) with ESMTP id 2A0EC522E8; Mon, 28 Nov 2005 09:48:45 +0100 (CET) Message-ID: <438AC32C.5040604@inria.fr> Date: Mon, 28 Nov 2005 09:43:24 +0100 From: Alain Frisch User-Agent: Debian Thunderbird 1.0.2 (X11/20050602) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christophe Raffalli Cc: Brian Hurt , caml-list@inria.fr Subject: Re: [Caml-list] Obj or not Obj References: <4387ACC9.2040107@motion-twin.com> <438A4CAA.6070006@univ-savoie.fr> In-Reply-To: <438A4CAA.6070006@univ-savoie.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 438AC46E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 438AC46D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 caml-list:01 christophe:01 raffalli:01 stack:01 compiler:01 wrote:01 integer:01 integer:01 expression:01 native:02 roots:02 alain:03 alain:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Christophe Raffalli wrote: > - using Obj requires the same knowledge as writing C interface ... It requires more knowledge: you must know how GC roots in the stack are detected in native code. In this respect, (Obj.magic 0) and (Obj.magic ()) are not the same, contrary to what you might believe if you only know how to write a C interface. (Obj.magic 0) makes the code generator believe that the result can only be an integer; it will thus not traced by the GC. Now, the same happens for the result of an expression like (if ... then Obj.magic 0 else ...) because the compiler knows, thanks to the type system, that if the then branch is an integer, then so is the else branch. You can imagine the consequences. (I've made this mistake - good thing Xavier was not too far.) -- Alain