Output contract's arguements

monarch_dodra monarchdodra at gmail.com
Thu Sep 19 03:29:21 PDT 2013


On Thursday, 19 September 2013 at 08:29:43 UTC, Maxim Fomin wrote:
>> In particular if/when we will have "contracts are 
>> managed/compiled by caller", then that behavior is the only 
>> behavior we will be able to do (AFAIK).
>>
>
> I looks like your misunderstanding based on wrong assumption 
> about implementation.

Not really a wrong assumption. This *has*. This has been 
discussed before. Another plan is to allow contracts in 
interfaces, in which case, there is no associated body:
http://d.puremagic.com/issues/show_bug.cgi?id=6549

>> Or is there something that explicitly states it works that 
>> way? Should I file a bug report? ER?
>
> I don't consider that whether out refers to unmodified or 
> modified parameter is important issue. Current policy should be 
> just documented and left as it is (unless you provide 
> significant reasons that current implementation is flawed).

It's flawed because the behavior of the contract will depend on 
what the body of the function does to copies of data that should 
be scoped only to that body.

An "out" contract should only verify that the value returned is 
correct "in regards" to the "input arguments".

This means the implementation details of the function's body are 
leaking into the out block. That just isn't right.


More information about the Digitalmars-d mailing list