On Tuesday, 29 July 2014 at 07:31:26 UTC, Walter Bright wrote:
You can choose to disable assertions with a switch, or not. Having a choice up to you doesn't make it useless.

Yes I know what are options to make it work. I don't know how to make it work "in a good style". This is not just D problem - I feel like something is missing in the design by contract idea, something that actually can make it robust enough to be used without "oh crap" moments.

Also, assertions are not for validating user input.

This is one of problems. When writing library function you don't exactly know if input is going to be user input. Use enforces - and it won't be possible to optimize away redundant checks. Use assertions and issue may slip uncaught.

It feels like for contracts to really work some good implementation of red-green code zones is necessarily, to be able to distinguish user input call paths from internal ones during compilation time.

Reply via email to