Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!clyde!concour!marcap From: marcap@concour.CS.Concordia.CA (Marc Pawlowsky) Newsgroups: comp.lang.eiffel Subject: Re: PEEVES Message-ID: <886@clyde.Concordia.CA> Date: 9 Jun 89 12:21:07 GMT References: <882@clyde.Concordia.CA> Sender: news@Clyde.Concordia.CA Reply-To: marcap@concour.CS.Concordia.CA (Marc Pawlowsky) Organization: Concordia University, Montreal Quebec Lines: 31 > deutsch@parcplace.com (L. Peter Deutsch) writes > >2) deepCopy is not a semantically useful notion. Where do you stop? Do >you copy classes as well as contents? If an object has a reference to >some widely shared data structure, do you copy that entire structure? >What about references to objects like Symbols (in Smalltalk), where >there is an invariant requiring unique representation of Symbols with >the same contents? > >I believe providing a deepCopy operation is a mistake. If it were up to >me, it would be removed from the Smalltalk-80 system. The deepCopy of Smalltalk is the same as Clone in Eiffel. It copies the first level of pointers. A common problem I have is that I am working with mutable objects. I am giving one specific example, but I have hit this trouble often. Gene = integer Chromosome = set of genes Population = set of chromosomes A permissable operation on the population is "mutation" which changes a genes value randomly with probability p(x). A comparison is needed between the before and after populations. To do the comparison it is necessary to keep a copy of the population. So, YES, the entire data structure should be copied. If it takes a lot of space the programmer must be careful. This is a normal programming problem.