{"id":49012,"date":"2025-08-22T21:20:52","date_gmt":"2025-08-23T01:20:52","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=49012"},"modified":"2025-08-22T21:20:52","modified_gmt":"2025-08-23T01:20:52","slug":"uncertaint","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2025\/08\/22\/uncertaint\/","title":{"rendered":"Uncertain&#x27E8;T&#x27E9;"},"content":{"rendered":"<p><a href=\"https:\/\/nshipster.com\/uncertainty\/\">Mattt Thompson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/nshipster.com\/uncertainty\/\">\n<p>In 2014, researchers at the University of Washington and Microsoft Research\n              proposed a radical idea:\n              What if uncertainty were encoded directly into the type system?\n              Their paper,\n              <em><a href=\"https:\/\/www.microsoft.com\/en-us\/research\/publication\/uncertaint-a-first-order-type-for-uncertain-data-2\/\">Uncertain&lt;T&gt;: A First-Order Type for Uncertain Data<\/a><\/em>\n              introduced a probabilistic programming approach that&rsquo;s both\n              mathematically rigorous and surprisingly practical.<\/p>\n<p>As you&rsquo;d expect for something from Microsoft in the 2010s, the paper is implemented in C#. But the concepts translate beautifully to Swift.<\/p>\n<p>[&#8230;]<\/p>\n<p>When you compare two <code>Uncertain<\/code> values,\n              you don&rsquo;t get a definitive <code>true<\/code> or <code>false<\/code>.\n              You get an <code>Uncertain&lt;Bool&gt;<\/code> that represents the <em>probability<\/em> of the comparison being <code>true<\/code>.<\/p>\n<p>[&#8230;]<\/p>\n<p>Using an abstraction like <code>Uncertain&lt;T&gt;<\/code> forces you to deal with uncertainty as a first-class concept\n              rather than pretending it doesn&rsquo;t exist.\n              And in doing so, you end up with much smarter code.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Mattt Thompson: In 2014, researchers at the University of Washington and Microsoft Research proposed a radical idea: What if uncertainty were encoded directly into the type system? Their paper, Uncertain&lt;T&gt;: A First-Order Type for Uncertain Data introduced a probabilistic programming approach that&rsquo;s both mathematically rigorous and surprisingly practical. As you&rsquo;d expect for something from Microsoft [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-08-23T01:20:54Z","apple_news_api_id":"2cb284e2-dea9-42f0-bb7a-c99958266a7c","apple_news_api_modified_at":"2025-08-23T01:20:54Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/ALLKE4t6pQvC7esmZWCZqfA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[263,71,901],"class_list":["post-49012","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-theory","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/49012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=49012"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/49012\/revisions"}],"predecessor-version":[{"id":49013,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/49012\/revisions\/49013"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=49012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=49012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=49012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}