Output contract's arguements
PauloPinto
pjmlp at progtools.org
Thu Sep 19 04:00:58 PDT 2013
On Thursday, 19 September 2013 at 10:44:32 UTC, monarch_dodra
wrote:
> On Thursday, 19 September 2013 at 10:38:37 UTC, Joseph Rushton
> Wakeling wrote:
>> On 18/09/13 14:11, monarch_dodra wrote:
>>> IMO, this is wrong. When calling a function with an out
>>> contract, the arguments
>>> should *also* be passed to the out contract directly. "out"
>>> should not be
>>> expected to run on the body's "sloppy seconds".
>>
>> I'm not sure I understand your objection here. As I
>> understood it the whole point of an "out" contract was to
>> check the state of everything _after the function has exited_.
>
> Exactly.
>
> If the function has already exited, then why is the state of he
> arguments modified? I though pass by value meant that the
> function operated on its own copy?
It does operate on its copy.
You modified the copy inside the function. The value at the call
site is not modified.
By the way, the is to be expected in Eiffel, Ada and .NET
contracts.
--
Paulo
More information about the Digitalmars-d
mailing list