From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id F1E03BB81 for ; Thu, 30 Dec 2004 12:03:25 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iBUB3P4C011641 for ; Thu, 30 Dec 2004 12:03:25 +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 MAA07292; Thu, 30 Dec 2004 12:03:25 +0100 (MET) Received: from postfix4-2.free.fr (postfix4-2.free.fr [213.228.0.176]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBUB3OM5019549; Thu, 30 Dec 2004 12:03:25 +0100 Received: from warp (chateaudeau-4-82-225-176-25.fbx.proxad.net [82.225.176.25]) by postfix4-2.free.fr (Postfix) with SMTP id 7E37D296959; Thu, 30 Dec 2004 12:03:24 +0100 (CET) Message-ID: <002f01c4ee5f$49820ca0$0100a8c0@warp> From: "Nicolas Cannasse" To: "Alain Frisch" , References: <025c01c4edab$a708d160$0100a8c0@warp> <41D2D205.5030106@inria.fr> <002001c4edc6$5f2b7e90$0100a8c0@warp> <41D358E2.4000604@inria.fr> Subject: Re: [Caml-list] Obj.dup crash ? Date: Thu, 30 Dec 2004 12:04:09 +0100 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.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Miltered: at nez-perce with ID 41D3E07D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41D3E07C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; cannasse:01 warplayer:01 caml-list:01 dup:01 dup:01 unspecified:01 syntax:01 ast:01 checker:01 instanciate:01 ocaml:01 runtime:01 compilation:01 cannasse:01 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: > Concerning Obj.dup, I guess it is never actually called when the block > has 0 fields. Actually, where is Obj.dup used except in > CamlinternalOO.copy ? Quick look. It is used in the code generator: > for array constants of size > 4, and for record expressions { ... with > ... } that copy the original record and then modify it (but the empty > record is not a valid type !). So indeed, it seems that Obj.dup is never > called for 0 fields blocks. The implementation has dead code, but > it is not buggy ;-) It's also used in ExtLib DynArray when copying an array ;) I understand that Obj is an undocumented/unspecified module but it should at least work as expected. Is there a particular reason for 0 fields blocks not being allocated ? Actually Obj.tag (Obj.new_block 0 0) returns 500 which is not really the expected result. > but the empty record is not a valid type It can't be parsed using default caml syntax but it surely can be represented into the AST since I expect it to be a "something list". Now I'm not sure such a type would pass the type checker or even how you're supposed to instanciate it :) Having 0 fields blocks might be useful for high level language features that want to use OCaml as their runtime system, because of its very good native compilation. Nicolas Cannasse