[swift-evolution] Proposal: Add implicit/default else-behaviour for the guard statement

Andrey Tarantsov andrey at tarantsov.com
Thu Dec 17 05:23:55 CST 2015


>> 4) I would love a “guard!” variant that crashes instead of returning.
> 
> Isn’t it the role of assert and precondition?

Well, there's another thread talking about an alternative name for assert. guard! could be a good one. And, yes, "guard! let" isn't currently possible with assert.

More importantly, sometimes I change my mind about whether something is a valid failure or should be a crash, and a one-character difference would be appreciated. (Granted, that doesn't happen often, just sometimes.)

A.



More information about the swift-evolution mailing list