Writing Bug-Free C/D Code

Dan murpsoft at hotmail.com
Wed Mar 21 06:44:14 PDT 2007


> It is only meant to be used during the development phases of an
> application, thus you should not use contracts to try and detect invalid
> input data for a function. Contract code should be used to detect logic
> errors and not data errors.
> Derek

Actually Derek, contracts as a concept have no such limitation.  Their current implementation only performs logic errors, but logic errors may be extended to include proof-by-induction number range theories.  The contract specification could be used to generate spectral graphing of function i/o, utilize such to raise errors, document exacting constraints, etc.; however nobody has yet programmed such a useful tool.

It would probably be as complicated as gaining access to the AST for D (or parsing it) and then performing a hint of linear algebra; with the added problem of needing to provide cross platform gui for the spectral graph if one was desireable, or simply throw additional errors when a bounds was exceeded or unchecked.



More information about the Digitalmars-d mailing list