December 14, 2004
tetsuya wrote:
>>>6. special scope rules in contract
>>>[...]
>>
>>Aren't the contracts compiled-in optionally? This would mean that if you don't want the contracts to be tested, the declaration in the in/out blocks should still be compiled, but not the statements? Odd.
> 
> 
> Hmm, I guess I need an example to understand it well.

The problem is that you say "'in' scope inherited by 'body' [...]". The spec says: "For a release build of the code, the in and out code is not inserted." So there is a conflict. I can't see what you would want to use the 'in' scope for in the 'body', and for the sake of efficiency I prefer the spec as it is now.

However, I do see the use for letting the scope of 'out' inherit the scope of 'in', which would allow your example. You have my vote on this one :-)

As for letting 'out' inherit the 'body' scope, I do not agree. The 'out' contract should verify that the function implementation ('body') does the right thing. For correctness, it is important that changes in the implementation can not change the contract, i.e., the test should be independent from the thing that is being tested. So the 'out' block should not have access to implementation details of the function, therefore I do not want 'out' to inherit the 'body' scope.

Cheers,
Bastiaan.
1 2 3
Next ›   Last »