{"id":1869,"date":"2012-10-21T20:00:23","date_gmt":"2012-10-21T19:00:23","guid":{"rendered":"https:\/\/www.reenigne.org\/blog\/?p=1869"},"modified":"2012-09-23T09:15:48","modified_gmt":"2012-09-23T08:15:48","slug":"the-variant-type-in-alfe","status":"publish","type":"post","link":"https:\/\/www.reenigne.org\/blog\/the-variant-type-in-alfe\/","title":{"rendered":"The Variant type in ALFE"},"content":{"rendered":"<p>This is part of the <a href=\"https:\/\/www.reenigne.org\/blog\/the-alfe-type-system\">ALFE types series<\/a>.<\/p>\n<p><strong>Variant<\/strong> is a type that can hold any value. It&#8217;s the type of all variables in a dynamically typed language. It&#8217;s a bit like a <a href=\"https:\/\/www.reenigne.org\/blog\/sum-types-in-alfe\">sum type<\/a> consisting of all other types summed together.<\/p>\n<p>In practice it&#8217;s probably not very useful, since to do anything with a <strong>Variant<\/strong> variable you have to cast it to some type, and since there&#8217;s a finite number of casts that you can write in one program, you might as well just make it a sum type of those. Still, it might come in handy for translating some programs written in other languages into ALFE, or even if you just don&#8217;t want to have to think too much about what the possible types are.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is part of the ALFE types series. Variant is a type that can hold any value. It&#8217;s the type of all variables in a dynamically typed language. It&#8217;s a bit like a sum type consisting of all other types summed together. In practice it&#8217;s probably not very useful, since to do anything with a [&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,27],"tags":[],"class_list":["post-1869","post","type-post","status-publish","format-standard","hentry","category-computer","category-language"],"_links":{"self":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/1869","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=1869"}],"version-history":[{"count":3,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/1869\/revisions"}],"predecessor-version":[{"id":1871,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/posts\/1869\/revisions\/1871"}],"wp:attachment":[{"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/media?parent=1869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/categories?post=1869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reenigne.org\/blog\/wp-json\/wp\/v2\/tags?post=1869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}