<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">On Mon, Oct 1, 2018, 9:13 PM Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For an application, it doesn't matter if my function sets the computer on fire when passed the string "fish", if there is no way for the application to pass that string to the function. If it can't happen, it can't happen and there's no need to defend against it beyond a regression test.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">How many times have you written or seen a comment in code similar to "This can't possibly happen!!" ... Usually in response to a failed debugging attempt.</div><div dir="auto"><br></div><div dir="auto">It's really hard to understands all possible execution paths that might result from all possible inputs and program states. "Fail early and fail hard" is a good principle... And indeed one generally in a spirit compatible with DbC.</div><div dir="auto"><br></div><div dir="auto"><span style="color:rgb(34,34,34);font-family:"helvetica neue",helvetica,"nimbus sans l",arial,"liberation sans",sans-serif;font-size:16px;background-color:rgb(255,255,255)">Beware of bugs in the above code; I have only proved it correct, not tried it.</span><ul style="margin:0px 0px 0px 1em;padding:0px 0px 0px 1em;border:0px;line-height:inherit;font-family:"helvetica neue",helvetica,"nimbus sans l",arial,"liberation sans",sans-serif;font-size:16px;vertical-align:baseline;background:none rgb(255,255,255);list-style-position:outside;color:rgb(34,34,34)"><li style="margin-top:0px;margin-right:0px;margin-bottom:inherit;margin-left:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;background:none">Donald Knuth</li></ul></div></div>