From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 0E48EBB9C for ; Wed, 21 Dec 2005 19:07:08 +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 jBLI76jx001985 for ; Wed, 21 Dec 2005 19:07:07 +0100 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 TAA15154 for ; Wed, 21 Dec 2005 19:07:06 +0100 (MET) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.200]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jBLI75Xj004963 for ; Wed, 21 Dec 2005 19:07:06 +0100 Received: by zproxy.gmail.com with SMTP id 9so210727nzo for ; Wed, 21 Dec 2005 10:07:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EK8DoCvUGaONXuFGXU/cKhw2n/p5TTLxbYNhJNWFweCQlJ0E/LFzZFIRYf+S4ZA0fvfuh0wQ55Euw8TIIfMsg2EE5UmHtlkj/w2g7UH7ReOcuJ090JXzs4FEg35g0IGpe610hHtOYeC2RvUujbW8OnwXbcyDaR5AGjKjVPl48cM= Received: by 10.65.84.2 with SMTP id m2mr746455qbl; Wed, 21 Dec 2005 10:07:05 -0800 (PST) Received: by 10.65.113.18 with HTTP; Wed, 21 Dec 2005 10:07:05 -0800 (PST) Message-ID: Date: Wed, 21 Dec 2005 11:07:05 -0700 From: Mackenzie Straight To: Jacques Garrigue Subject: Re: [Caml-list] syntax bug: copying records Cc: skaller@users.sourceforge.net, caml-list@inria.fr In-Reply-To: <20051221.194137.12318829.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1135142554.18811.16.camel@rosella> <20051221.194137.12318829.garrigue@math.nagoya-u.ac.jp> X-Miltered: at concorde with ID 43A999CA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 43A999C9.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 syntax:01 bug:01 dup:01 notation:01 runtime:01 sidewalk:98 wrote:01 abstract:01 jacques:01 segmentation:02 garrigue:03 garrigue:03 let:03 let: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=RCVD_BY_IP autolearn=disabled version=3.0.3 On 12/21/05, Jacques Garrigue wrote: > # copy 3;; > Segmentation fault I know. You can check the tag first if you really want. Like this: let copy x =3D let r =3D Obj.repr x in if Obj.is_block r then Obj.obj (Obj.dup r) else x Of course, we all know that using Obj is equivalent to using a dirty syringe you found on the sidewalk, so... Danger! > This also explains why you need at least one record field in the > "with" notation, otherwise there is no way to know for sure the type > of the record you're copying. True. Well, you don't actually need to know the type (indeed, the runtime system needs to have enough information to copy values). But I imagine it could have disastrous consequences when copying abstract values anyway.