An old topic (pun intended)

Timon Gehr timon.gehr at gmx.ch
Sun Oct 16 15:29:30 PDT 2011


On 10/16/2011 07:31 PM, Jonathan M Davis wrote:
> On Sunday, October 16, 2011 19:13:09 Timon Gehr wrote:
>> I don't agree that 'old' is very difficult to implement. Just evaluate
>> what is inside the 'old' before you enter the in contract, store
>> somewhere, maybe in hidden local variables, and make the data available
>> in the out contract. Eiffel's 'old' does not do more than that.
>>
>> (but perhaps there are implementation details in DMD that make this more
>> difficult than necessary. I don't know.)
>
> What if you're dealing with a class? You'd need to deep copy the entire object
> for it to work. There's no way built into the language to do that (not to
> mention that it would be horrifically inefficient).
>
> - Jonathan M Davis

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()).


More information about the Digitalmars-d-learn mailing list