{"id":132,"date":"2008-09-18T18:49:11","date_gmt":"2008-09-18T23:49:11","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/09\/18\/i-would-rather-have-a-runtime-error-than-a-compile-error\/"},"modified":"2008-09-18T18:49:13","modified_gmt":"2008-09-18T23:49:13","slug":"i-would-rather-have-a-runtime-error-than-a-compile-error","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/09\/18\/i-would-rather-have-a-runtime-error-than-a-compile-error\/","title":{"rendered":"I Would Rather Have a Runtime Error Than a Compile Error"},"content":{"rendered":"<blockquote><p>And the weird thing is, I realized early in my career that I would actually rather have a runtime error than a compile error. [(<em>some laughs<\/em>)] Because at that time&#8230; now this is way contrary to popular opinion. Everybody wants early error detection. Oh God, not a runtime error, right? But the debugger gives you this ability to start poking and prodding, especially in a more dynamic language, where you can start simulating things, you can back it up&#8230; You&#8217;ve got your time-machine debuggers like the OCaml one, that can actually save the states and back up.<\/p>\n<p>You&#8217;ve got amazing tools at your disposal (in the debugger)&#8230; Whereas if the compiler gives you an error that says &#8220;expected expression angle-bracket&#8221;, you don&#8217;t have a &#8220;compiler-debugger&#8221; that you can shell into&#8230;<\/p>\n<p><strong>So, you know, in some sense, your runtime errors are actually kind of nicer.<\/strong><\/p><\/blockquote>\n<p>&#8212; An excerpt from <a href=\"http:\/\/steve-yegge.blogspot.com\/2008\/05\/dynamic-languages-strike-back.html\">one of Steve Yegge&#8217;s (long!) talks<\/a>.<\/p>\n<p>I think there is a real nugget of truth in this.  At runtime, you can examine your program&#8217;s <em>state<\/em>, but there is absolutely no way to do that at compile time.  Without a debugger, you can&#8217;t just look at some nontrivial code and <em>know<\/em> what the value of <code>x<\/code> is when there&#8217;s an error reading <code>y<\/code>.  (Adding <code>\"print x\"<\/code>, recompiling, and trying again, would work of course, but that&#8217;s just using your compiler as an inefficient debugger!)<\/p>\n<p>Similarly, <em><a href=\"http:\/\/www.mindview.net\/WebLog\/log-0025\">Strong Typing vs. Strong Testing<\/a> <\/em>, essentially argues that some tests can only be made at runtime.  (If you read any links on this page, <a href=\"http:\/\/www.mindview.net\/WebLog\/log-0025\">read it<\/a>, it&#8217;s much shorter and to the point).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>And the weird thing is, I realized early in my career that I would actually rather have a runtime error than a compile error. [(some laughs)] Because at that time&#8230; now this is way contrary to popular opinion. Everybody wants early error detection. Oh God, not a runtime error, right? But the debugger gives you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,24,93],"tags":[77,178,169,179],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-programming","category-quotes","category-reverse-engineering","tag-debugging","tag-dynamic-typing","tag-software-development","tag-static-typing"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}