{"id":1665,"date":"2010-07-04T19:01:08","date_gmt":"2010-07-04T19:01:08","guid":{"rendered":"http:\/\/spinor.info\/weblog\/?p=1665"},"modified":"2010-07-04T19:01:08","modified_gmt":"2010-07-04T19:01:08","slug":"goto","status":"publish","type":"post","link":"https:\/\/spinor.info\/weblog\/?p=1665","title":{"rendered":"goto"},"content":{"rendered":"<p>I hate dogma. I hate it even more when a valid scientific observation becomes dogma.<\/p>\n<p>One case concerns the infamous <tt>goto<\/tt> statement in programming languages. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Structured_program_theorem\">It is true<\/a> that a programming language does not need a <tt>goto<\/tt> statement in order to be universal. Unfortunately, this led some, most notably among them the late <a href=\"http:\/\/en.wikipedia.org\/wiki\/Edsger_Dijkstra\">Edsger Dijkstra<\/a>, to conclude that <tt>goto<\/tt> is actually harmful. While it is true that <tt>goto<\/tt> can be misused, and that misusing the constructs of a programming language can lead to bad code, I don&#8217;t think <tt>goto<\/tt> is unique in this regard (it is certainly no more harmful than pointers, global variables, or the side effects of passing variables by reference, just to name a few examples). Nonetheless, with Dijkstra&#8217;s letter on record, the making of a dogma was well under way.<\/p>\n<p>And here I am, some 40 years later, trying to write a simple piece of code the logic of which flows like this:<\/p>\n<p style=\"padding-left: 30px;\"><tt>LET X = A<\/tt><br \/>\n<tt>LABEL:<\/tt><br \/>\nDo something using <tt>X<\/tt><br \/>\n<tt>IF<\/tt> some condition is not satisfied <tt>THEN LET X = B<\/tt> and <tt>GOTO LABEL<\/tt><\/p>\n<p>The condition, in particular, is always satisfied when <tt>X = B<\/tt>.<\/p>\n<p>Yes, I know how to rewrite the above code using a loop construct, to satisfy structured programming purists. But why should I have to, when the most natural way to express this particular algorithm is through the use of a conditional jump, not a loop? Oh wait&#8230; it&#8217;s because someone who actually believes in dogma prevailed when the JavaScript was designed, and therefore, <tt>goto<\/tt> never made it into the language.<\/p>\n<fb:like href='https:\/\/spinor.info\/weblog\/?p=1665' send='false' layout='button_count' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida grande'><\/fb:like>","protected":false},"excerpt":{"rendered":"<p>I hate dogma. I hate it even more when a valid scientific observation becomes dogma. One case concerns the infamous goto statement in programming languages. It is true that a programming language does not need a goto statement in order to be universal. Unfortunately, this led some, most notably among them the late Edsger Dijkstra, <a href='https:\/\/spinor.info\/weblog\/?p=1665' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-1665","post","type-post","status-publish","format-standard","hentry","category-programming","category-36-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/1665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1665"}],"version-history":[{"count":2,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/1665\/revisions"}],"predecessor-version":[{"id":1667,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=\/wp\/v2\/posts\/1665\/revisions\/1667"}],"wp:attachment":[{"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spinor.info\/weblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}