On 10/16/2011 9:35 PM, Alex Rønne Petersen wrote:
On 17-10-2011 02:43, bearophile wrote:
Timon Gehr:
Eiffel does not do that either.
(even though it _does_ have a built in deep copy feature)
We don't have to over-engineer the feature, if somebody needs to
deep-copy an object they can implement it themselves and use
old(obj.deepCopy()).
I agree. A shallow prestate is quite better than not having it at all
in D.
Lately C# has implemented DbC, prestate too. I don't know how, but
it's worth taking a look.
Bye,
bearophile
Just for the record, the documentation is at:
http://download.microsoft.com/download/C/2/7/C2715F76-F56C-4D37-9231-EF8076B7EC13/userdoc.pdf
I agree that having old would be great, even if without deep copying
(which is probably a terrible idea anyway). Also note that C# doesn't do
deep copying here.
- Alex
Remember, efficiency is not the point, correctness is. Contract code
goes away in the release build. (Arguably you might want to keep
*preconditions* in library code, since they vet your input parameters.
But in practice those usually go away in release builds as well, even in
Eiffel.)
-- Dai