[swift-evolution] guard let x = x

Josh Parmenter jparmenter at vectorform.com
Wed Oct 26 12:09:34 CDT 2016


On Oct 26, 2016, at 9:37 AM, Chris Lattner via swift-evolution <swift-evolution at swift.org<mailto:swift-evolution at swift.org>> wrote:

To me, this is the most promising direction, but I’d suggest the use of “unwrap" as the keyword.  If you compare these two:

a) guard let foobar = foobar else { … }
b) guard unwrap foobar else { … }

I think that b) wins by virtue of eliminating repetition ("foobar = foobar" fails DRY principles), but retains clarity by introducing a word into the grammar that people already commonly know and use, and which is googlable if they don’t.

I find b) to be quite convincing.

Best,

Josh



Joshua Parmenter | Engineering Lead, Apple Technologies

T 248 777 7777
C 206 437 1551
F 248 616 1980
www.vectorform.com<http://www.vectorform.com/>

Vectorform
2107 Elliott Ave Suite 303
Seattle, WA  98121 USA

Think Tank. Lab. Studio.
We invent digital products and experiences.

SEATTLE | DETROIT | NEW YORK | MUNICH | HYDERABAD



More information about the swift-evolution mailing list