An old topic (pun intended)

bearophile bearophileHUGS at lycos.com
Thu Oct 13 02:35:52 PDT 2011


Davidson Corry:

> Did D2 ever implement the Eiffel "old" construct?

At the moment there no prestate in D. I agree that prestate is an important sub-feature of contract programming. It was discussed two or three times, but the discussions didn't produce actual results. I think it was not implemented because I think Walter thinks D contract programming is a half failure (I don't agree on this) and because implementing the prestate is a bit tricky. I suggest to ask about this in the main D newsgroup, and show two use cases too. I think if enough people show use cases, and someone writes a good enough pull request for DMD, it will be added to D/DMD.


> If not, has anyone developed a reasonable workaround? Thanks.

In classes inside a debug I have defined handmade "ghost attributes":

debug {
  int ghost1, ghost2;
}

I use them to manually store the prestate that later I want to verify. This is not a very good solution...

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list