Improve "Improve Contract Syntax" DIP 1009
Ola Fosheim Grøstad
ola.fosheim.grostad+dlang at gmail.com
Sat Nov 4 15:27:39 UTC 2017
On Saturday, 4 November 2017 at 14:12:08 UTC, Adam D. Ruppe wrote:
> On Saturday, 4 November 2017 at 13:59:39 UTC, Jonathan M Davis
> wrote:
>> I'm very much of the opinion that proper unit tests pretty
>> much eliminate the need for out contracts.
>
> I think that sqrt example is just bad. Out contracts shouldn't
> be testing specific values, but rather ranges or nullness or
> other such things that arguably should be part of the return
> type, but just don't fit in the type system for whatever reason.
No, Jonathan is correct. The postcondition should be able to
access values as they were stated in the precondition.
More information about the Digitalmars-d
mailing list