Davidson Corry:

>      (continuing a thread from D.learn)

I think you have written this post in digitalmars.D in a moment when the 
limited brain power is busy with lot of other things :-)

I'd like some form of prestate to be implemented in D2. Usually I use manually 
managed ghost variables (inside a debug{}) to solve this problem, but a more 
built-in solution is better and more standard.


> Eiffel supports an 'old' construct in post-conditions.

It's often named "prestate".


>      out(result, X preX = exprX, Y preY = exprY) {   // <== prestate 

I'd like something lighter, syntax-wise, where the is no need to state new and 
old names and types:

>      out(result, exprX, exprY) {

And then the compiler lets you access in the postcondition the old variables in 
some standard way, like:

in.exprX, in.exprY

Despite this is is probably better looking:

old.exprX, old.exprY

Here "old" doesn't need to be keyword, it's like the local name of a struct 
instance.

As discussed in D.learn there is no need for deep copying of the old variables. 
If it's required, then the programmer has to do it manually by herself. This 
avoids lot of implementation complexities.

Bye,
bearophile

Reply via email to