On 2/4/15 5:32 PM, deadalnix wrote:
On Thursday, 5 February 2015 at 01:07:56 UTC, Andrei Alexandrescu wrote:
Yah, I agree "in" is useful for overridable functions. In fact I'd say
it's useful _only_ for overridable functions.


Putting the contract in the caller is not only useful for overridable
functions.

1/ If a lib is compiled in without contract, but your code is compiled
with, you get the in contract to run when you call library code, but not
the assert within the function.

2/ The optimizer see the properties of the argument when they get to the
in contract. This information is lost in the callee, unless inlining
goes on. that means the amount of contract the optimizer can remove
statically is greater with in contract.

Yah, I understand the potential there. Consider me grudgingly convinced :o). -- Andrei

Reply via email to