On 2/21/2012 2:29 PM, Ali Çehreli wrote:
On 02/18/2012 09:09 PM, Jim Hewes wrote:
> I think of exception handling as tied to contract programming.
I think your use of the word 'contract' is colliding with the contract
programming feature. What you describe later does not match with the
contract programming and I guess is the reason why Andrei is pointing
out two chapters from TDPL.
I will reread those chapters later today but I think Andrei is referring
to the distinction between assert() and std.exception.enforce().
Thanks. I assume the objection is about the bad parameters. In design by
contract, a function should not be checking the input, correct? It
assumes it's correct. But I was mostly thinking of the case when the
functions are more of a public API and you can't trust the input. I did
mention using assert for internal functions. But I guess if you are
strict, you should never check input. I just shouldn't mention design by
contract at all then. :)