{"id":844,"date":"2008-11-03T16:00:01","date_gmt":"2008-11-03T23:00:01","guid":{"rendered":"https:\/\/www.reenigne.org\/blog\/?p=844"},"modified":"2008-10-29T17:10:04","modified_gmt":"2008-10-30T00:10:04","slug":"non-local-control-structures","status":"publish","type":"post","link":"https:\/\/www.reenigne.org\/blog\/non-local-control-structures\/","title":{"rendered":"Non-local control structures"},"content":{"rendered":"<p>Most of the time in computer programming, causes are linked to effects by code at the \"cause\" point - i.e. if A should cause B then the routine that implements A should call the routine that implements B.<\/p>\n<p>Sometimes, however, there is a need for effects to happen as a result of causes which don't know about those effects. The obvious example is <a href=\"http:\/\/en.wikipedia.org\/wiki\/COMEFROM\">COMEFROM<\/a> but there are serious examples as well. Breakpoints and watchpoints when you're debugging is one, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Database_trigger\">Database triggers<\/a> are another.<\/p>\n<p>A more subtle example is the humble destructor in C++ (which I have <a href=\"https:\/\/www.reenigne.org\/blog\/destructors\">written about before<\/a>) - it's effect is non-local in the sense that if you construct an automatic object in a scope, code will automatically run when control passes out of that scope. It's still a local effect in that the cause and the effect are in the same scope, but it's non-local in the sense that there is no explicit code at the point where the destructor is run.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most of the time in computer programming, causes are linked to effects by code at the \"cause\" point - i.e. if A should cause B then the routine that implements A should call the routine that implements B. Sometimes, however, there is a need for effects to happen as a result of causes which don't [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-844","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/comments?post=844"}],"version-history":[{"count":1,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":845,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/844\/revisions\/845"}],"wp:attachment":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/media?parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/categories?post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/tags?post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}