Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] Deep copy
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alessandro Baretta <alex@b...>
Subject: Re: [Caml-list] Deep copy
Eray Ozkural wrote:
 > An equivalent of C++'s copy constructor would be
 > required. Can this be done without going "inside" the
 > ocaml system? :)

Please, leave copy constructors alone. They are among the
most hideous enemies of an OO programmer. The copy 
constructor always has very delicate interactions with 
assignment and function invocation, and since one often 
needs to redefine the copy constructor, for example to get 
deep copies as opposed to shallow copies, it is a serious 
source of bugs.

O'Caml has a neat OO system, with a single constructor and 
no destructors. I don't think it needs to borrow many ideas 
from C++.

Alex

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