Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Safe Obj.dup?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michal Moskal <malekith@p...>
Subject: Re: [Caml-list] Safe Obj.dup?
On Wed, Aug 06, 2003 at 01:02:51PM -0700, David Brown wrote:
> Is there an officially safe way of doing an Obj.dup?  I have a record
> type with mutable fields, and I'd like to be able to make a copy of it.

let r = {x = 3; y = 7} in
let copy = {r with x = r.x}

You cannot say {r with } although I don't see any reason why.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h

-------------------
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