Only want to say

Jacob Carlborg doob at me.com
Tue Jan 12 14:02:02 UTC 2021


On Monday, 11 January 2021 at 18:33:58 UTC, ddcovery wrote:

> I understand... As long as I have seen, the own std library 
> makes an intensive use of unitesting and avoids the in/out 
> contract keywords (mainly, I suppose, because it is a 
> "run-time" check with the obvious performance fault ).

No, it's not a performance issue, contracts can be disabled at 
compile time and are in the standard library.

There are several problems with the implementation of contracts 
in D, which I think make them less useful and contribute to the 
reason why they're not very commonly used.

* in-contracts are not included in the generated documentation
* in-contracts are executed by the callee instead of the caller
* No compile time check of contracts are performed, if it would 
be possible
* DMD ships with a standard library compiled for release builds, 
i.e. without contracts and asserts. LDC on the other hand, ships 
both a with debug build and with a release build of the standard 
library

--
/Jacob Carlborg


More information about the Digitalmars-d mailing list