On Thursday, 29 June 2017 at 01:37:17 UTC, H. S. Teoh wrote:
(1) DbC contracts pertain to *runtime* argument values, so while
checking for simple cases at compile-time is nice, it isn't
really in
the charter of (D's implementation of) DbC.
T
That's a good point.
I guess UDAs combined with static assert is the right way to
implement compile-time checkable contracts. This seems to be the
approach taken by Andrei in his Big O notation library [1].
Anyway, contracts are still useful for documentation purposes, as
was pointed out. Personally I like them because they encourage me
to think carefully about the preconditions and postconditions of
the functions I write.
[1]
http://forum.dlang.org/post/[email protected]