[swift-evolution] [pitch] rename 'guard' to 'ensure'

Chris Lattner clattner at apple.com
Wed Oct 26 11:41:14 CDT 2016


On Oct 26, 2016, at 1:11 AM, alessandro aresta <performerstone at gmail.com> wrote:
> Ensure is more comprehensible, guard is for sure "always" been there in older languages... could it be kind of aliased somehow? I tend to confuse guard sometimes, despite many few decades of using it.

No, we don’t introduce needless aliases for keywords like this.

I haven’t seen it mentioned on this thread yet, but we did consider “ensure” back when the guard statement was being designed for Swift 2.  We specifically avoided it because “ensure” is very much in the lexicon of pre and post conditions, and we want to reserve its use if/when we ever get there.

-Chris


More information about the swift-evolution mailing list