{"id":14957,"date":"2016-06-23T12:00:06","date_gmt":"2016-06-23T16:00:06","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=14957"},"modified":"2023-08-01T12:59:47","modified_gmt":"2023-08-01T16:59:47","slug":"restructuring-swift-condition-clauses","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/06\/23\/restructuring-swift-condition-clauses\/","title":{"rendered":"Restructuring Swift Condition Clauses"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/master\/proposals\/0099-conditionclauses.md\">SE-0099<\/a> (via <a href=\"http:\/\/ericasadun.com\/2016\/06\/10\/swift-where-oh-where-can-my-where-clause-be\/\">Erica Sadun<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/apple\/swift-evolution\/blob\/master\/proposals\/0099-conditionclauses.md\"><p>Swift condition clauses appear in <code>guard<\/code>, <code>if<\/code>, and <code>while<\/code> statements. This proposal re-architects the condition grammar to enable an arbitrary mix of Boolean expressions, <code>let<\/code> conditions (which test and unwrap optionals), general <code>case<\/code> clauses for arbitrary pattern matching, and availability tests.  It removes <code>where<\/code> clauses from optional binding conditions and case conditions, and eliminates gramatical ambiguity by using commas for separation between clauses instead of using them both to separate clauses and terms within each clause.  These modifications streamline Swift&rsquo;s syntax and alleviate the situation where many Swift developers don&rsquo;t know they can use arbitrary Boolean conditions after a value binding.<\/p><\/blockquote>\n<p>Bravo.<\/p>","protected":false},"excerpt":{"rendered":"<p>SE-0099 (via Erica Sadun): Swift condition clauses appear in guard, if, and while statements. This proposal re-architects the condition grammar to enable an arbitrary mix of Boolean expressions, let conditions (which test and unwrap optionals), general case clauses for arbitrary pattern matching, and availability tests. It removes where clauses from optional binding conditions and case [&hellip;]<\/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":"2023-08-01T16:59:50Z","apple_news_api_id":"e5142017-8c99-4f45-a8de-927035982be2","apple_news_api_modified_at":"2023-08-01T16:59:50Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A5RQgF4yZT0Wo3pJwNZgr4g","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":[46,71,901],"class_list":["post-14957","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/14957","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=14957"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/14957\/revisions"}],"predecessor-version":[{"id":40219,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/14957\/revisions\/40219"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=14957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=14957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=14957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}