Restructuring Swift Condition Clauses
SE-0099 (via Erica Sadun):
Swift condition clauses appear in
guard
,if
, andwhile
statements. This proposal re-architects the condition grammar to enable an arbitrary mix of Boolean expressions,let
conditions (which test and unwrap optionals), generalcase
clauses for arbitrary pattern matching, and availability tests. It removeswhere
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’s syntax and alleviate the situation where many Swift developers don’t know they can use arbitrary Boolean conditions after a value binding.
Bravo.