An old topic (pun intended)
Alex Rønne Petersen
xtzgzorex at gmail.com
Mon Oct 17 08:35:41 PDT 2011
On 17-10-2011 07:59, Davidson Corry wrote:
> 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
Right, but you don't want your debug builds to be so slow that it makes
you unproductive either. Either way, an initial lightweight old() would
already be much better than having nothing. :)
- Alex
More information about the Digitalmars-d-learn
mailing list