A possible enhancement for Contract Programming:
http://d.puremagic.com/issues/show_bug.cgi?id=5027
This is not meant as a replacement for "old" (that allows to refer to the state
at the entry to the instance method).
Bye,
bearophile
bearophile napisał:
> The ghost fields may be used to store partial computations useful to reduce
> the work done
by the class invariant.
You can do:
class C {
version(unittest) int temp;
invariant() {
// use temp
}
}
Or am I missing something?
--
Tomek
Tomek S.:
> You can do:
>
> class C {
> version(unittest) int temp;
> invariant() {
> // use temp
> }
> }
>
> Or am I missing something?
D2 has several ways to perform conditional compilation, so you may implement
hand-made ghost fields using a version(debug). And ghost fields are ve
On Sat, 09 Oct 2010 23:51:44 +0400, Tomek Sowiński wrote:
bearophile napisał:
The ghost fields may be used to store partial computations useful to
reduce the work done
by the class invariant.
You can do:
class C {
version(unittest) int temp;
invariant() {
// use temp
}
}
Or am
> And ghost fields are very important to start with (I was not sure to submit
> an enhancement request).
Sorry, I meant, 'And ghost fields aren't very important to start with'.
Bye,
bearophile
bearophile napisał:
> Tomek S.:
>
>> You can do:
>>
>> class C {
>> version(unittest) int temp;
>> invariant() {
>> // use temp
>> }
>> }
>>
>> Or am I missing something?
>
> D2 has several ways to perform conditional compilation, so you may
> implement hand-made ghost fields using a