From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA16589; Thu, 14 Aug 2003 10:22:01 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 KAA16978 for ; Thu, 14 Aug 2003 10:22:00 +0200 (MET DST) Received: from mwinf0301.wanadoo.fr (smtp6.wanadoo.fr [193.252.22.28]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h7E8M0T02146 for ; Thu, 14 Aug 2003 10:22:00 +0200 (MET DST) Received: from foorama (APastourelles-107-1-9-31.w80-13.abo.wanadoo.fr [80.13.163.31]) by mwinf0301.wanadoo.fr (SMTP Server) with SMTP id 8658540081B; Thu, 14 Aug 2003 10:21:59 +0200 (CEST) Message-ID: <002401c3623d$22c3f2e0$0201a8c0@foorama> From: "Florian Douetteau" To: "Jacques Garrigue" Cc: References: <20030814105551S.garrigue@kurims.kyoto-u.ac.jp> Subject: Re: [Caml-list] Obj.magic, Obj.t etc. Date: Thu, 14 Aug 2003 10:22:00 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; florian:01 douetteau:01 caml-list:01 val:01 abstr:01 subtyping:01 unboxed:01 compile-time:01 runtime:01 ocaml:01 supported:01 segmentation:01 float:02 obj:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > As an interesting aside, I've discovered recently that even Obj.repr > is dangerous: > > # Obj.repr;; > - : 'a -> Obj.t = > # let arr = Array.create 1 (Obj.repr 1.0);; > val arr : Obj.t array = [||] > # arr.(0) <- Obj.repr 1;; > Segmentation fault > > >From a subtyping point of view, this basically means that there cannot > be any "top" element in the ocaml type system. To be fully accurate, it only means that the current implementation of the code generator would not support it directly. If subtyping was to be supported, an unboxed float array would be created iff its the compile-time type "float array" (it would be created boxed if typed "Top array") . I don't know if the current runtime implementation makes other assumptions of the same kind about the lack of subtyping; for instance, the gc could avoid marking the content of an array starting with an unboxed integer ? Same thing about list cells. -- Florian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners