Output contract's arguements

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Sep 19 10:17:15 PDT 2013


On 9/19/13 4:18 AM, monarch_dodra wrote:
> On Thursday, 19 September 2013 at 11:11:58 UTC, Peter Alexander wrote:
>> On Thursday, 19 September 2013 at 11:07:07 UTC, Artur Skawina
>>> That "final value of v" is not part of any contract, it's just a private
>>> local.
>>
>> I repeat my question then: what would you want this to do? As you say,
>> v is a local copy, it cannot be part of a contract -- it cannot affect
>> anything the client code sees.
>
> I'd like the out contract to operate on its own copies of the function's
> arguments.
>
> These could either be passed by the implementation of the body, prior to
> starting proper, or by the caller, passing the same arguments to both
> the contract and the function. That'd be dependent on the implementation.

This can confuse people who'd expect the converse. Also, indirect 
changes would add to the confusion. Then what to do about stuff by ref? 
auto ref?

I think it's safe to stick with the current behavior.


Andrei



More information about the Digitalmars-d mailing list