{"id":274,"date":"2022-08-30T14:58:37","date_gmt":"2022-08-30T14:58:37","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/08\/31\/do-all-programming-languages-have-a-clear-concept-of-nil-null-or-undefined-record-and-share-programming-errors\/"},"modified":"2022-08-30T14:58:37","modified_gmt":"2022-08-30T14:58:37","slug":"do-all-programming-languages-have-a-clear-concept-of-nil-null-or-undefined-record-and-share-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/do-all-programming-languages-have-a-clear-concept-of-nil-null-or-undefined-record-and-share-programming-errors\/","title":{"rendered":"Do all programming languages have a clear concept of NIL, null, or undefined?-Record and share programming errors"},"content":{"rendered":"<p>This is a type system question, so anyone who answers &#8220;0&#8221; misses the point.<\/p>\n<p>What you&#8217;re talking about is a sum type (check &#8220;Types and Programming Languages&#8221;).<\/p>\n<p>That is, a type that has n + 1 inhabitants. That is, the type whose elemens are:<\/p>\n<ul>\n<li>all the values of the type you care about<\/li>\n<\/ul>\n<p>OR<\/p>\n<p>This is easily described as an algebraic data type, e.g. in Haskell<\/p>\n<pre><code>data Maybe a = Just a | Nothing\n<\/code><\/pre>\n<p>Bizarrely, relatively few languages support sum types, so they encode them as products (a pair of the tag Just or Nothing, and the value itself) or by overloading one of the inhabitants of the type (e.g. -1 or 0 becomes Nothing).<\/p>\n<p>This type is usually known as Maybe or Optional.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-08-31 08:13:57. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>This is a type system question, so anyone who answers &#8220;0&#8221; misses the point. What you&#8217;re talking about is a sum type (check &#8220;Types and Programming Languages&#8221;). That is, a type that has n + 1 inhabitants. That is, the type whose elemens are: all the values of the type you care about OR This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-274","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}