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 5FE25BB91 for ; Sat, 22 Jan 2005 17:55:22 +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 j0MGtLcw032670 for ; Sat, 22 Jan 2005 17:55:21 +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 RAA27666 for ; Sat, 22 Jan 2005 17:55:21 +0100 (MET) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0MGtKUc032667 for ; Sat, 22 Jan 2005 17:55:21 +0100 Received: by wproxy.gmail.com with SMTP id 68so313455wri for ; Sat, 22 Jan 2005 08:55:20 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=BiJKjOYSz/eUtBtiabUxImCv7sQRwapApsOpYsH1YQACvtXfcfJ4jRVojzsTds3+yCRk8J8uKYCwhZkoPq7iJoVgFh05XTZxNclYIBRdKcVbQ649XiF/Ux/xfwXTwW4E/aJ/5Ujlb5f0BWy17bnUsxGx0vEMLsTeNGw8khteIdw= Received: by 10.54.52.40 with SMTP id z40mr117223wrz; Sat, 22 Jan 2005 08:55:19 -0800 (PST) Received: by 10.54.5.8 with HTTP; Sat, 22 Jan 2005 08:55:19 -0800 (PST) Message-ID: <875c7e070501220855a997f7e@mail.gmail.com> Date: Sat, 22 Jan 2005 11:55:19 -0500 From: Chris King Reply-To: Chris King To: Jacques Garrigue Subject: Re: [Caml-list] Shallow copy of a record Cc: caml-list@inria.fr In-Reply-To: <20050122.154909.132744958.garrigue@math.nagoya-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <875c7e0705012120277c090ec8@mail.gmail.com> <20050122.154909.132744958.garrigue@math.nagoya-u.ac.jp> X-Miltered: at nez-perce with ID 41F28579.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41F28578.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 wrote:01 foo:01 foo:01 dup:01 define:01 jacques:01 unsafe:01 labels:02 seems:03 garrigue:03 garrigue:03 chris:05 determines:06 trick:06 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=RCVD_BY_IP autolearn=disabled version=3.0.0 X-Spam-Level: On Sat, 22 Jan 2005 15:49:09 +0900 (JST), Jacques Garrigue wrote: > This does not exist, and with good reason: there is no way in the type > system to define a function which works on all records, but only > records. So to do the copy you need to know at least one of the labels > of the record, which in turn gives you its type. Isn't it the foo in {foo with a=b} that determines the type, though? > Another approach, which is potentially unsafe, is to use the Obj.dup > function. That seems like it would do the trick for now - thanks!