{"id":13128,"date":"2015-12-16T08:44:19","date_gmt":"2015-12-16T13:44:19","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=13128"},"modified":"2015-12-16T08:45:09","modified_gmt":"2015-12-16T13:45:09","slug":"precondition-vs-assert-in-swift","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/12\/16\/precondition-vs-assert-in-swift\/","title":{"rendered":"precondition vs. assert in Swift"},"content":{"rendered":"<p><a href=\"http:\/\/ericasadun.com\/2015\/12\/15\/interesting-discussions-on-swift-evolution\/\">Erica Sadun<\/a> quotes Dave Abrahams:<\/p>\n<blockquote cite=\"http:\/\/ericasadun.com\/2015\/12\/15\/interesting-discussions-on-swift-evolution\/\">\n<p>The two functions have distinct roles:<\/p>\n<ul>\n<li>assert: checking your own code for internal errors.<\/li>\n<li>precondition: for checking that your clients have given you valid arguments.<\/li>\n<\/ul>\n<p>It&rsquo;s actually important to distinguish these two cases because the second one demands public documentation while the first does not.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Erica Sadun quotes Dave Abrahams: The two functions have distinct roles: assert: checking your own code for internal errors. precondition: for checking that your clients have given you valid arguments. It&rsquo;s actually important to distinguish these two cases because the second one demands public documentation while the first does not.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","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":[27,71,901],"class_list":["post-13128","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-craft","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13128","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=13128"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13128\/revisions"}],"predecessor-version":[{"id":13129,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/13128\/revisions\/13129"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=13128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=13128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=13128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}