[swift-evolution] Rename 'guard' to 'ensure'

John Flanagan john at jflan.com
Fri Feb 19 15:49:40 CST 2016


The functionality of ‘guard’ is great and this proposal has nothing to do with changing that. The only suggestion is that the word ‘ensure’ would better communicate what a ‘guard’ statement does to those encountering it for the first time and would make code more readable in general.

Example:

ensure foo != nil else {
   return;
}

-John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160219/a498320e/attachment.html>


More information about the swift-evolution mailing list