Out contracts: how to refer to objects' start state

bearophile bearophileHUGS at lycos.com
Sat May 25 18:25:40 PDT 2013


Andrei Alexandrescu:

> The problem with this is well-defining it. Since every in.xyz 
> expression could access an arbitrary method of the old object, 
> that means the whole object would need to be somehow 
> duplicated. Alternatively, all in.xyz expressions would need to 
> be evaluated before the function's entry point, which is weird 
> (what order? how about side effects? etc).
>
> The whole in.xyz trick (or as in Eiffel old.xyz) is inherently 
> flimsy. I'd rather allow the user to save and check their own 
> state instead, without resorting to a complicated definition.

Then we have to take a look at how C# and Ada solve such problem 
(both support the pre-state).

Bye,
bearophile


More information about the Digitalmars-d mailing list