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

Matt Whiteside mwhiteside.dev at gmail.com
Tue Feb 23 14:52:28 CST 2016

> On Feb 23, 2016, at 00:54, Radosław Pietruszewski via swift-evolution <swift-evolution at swift.org> wrote:
> I don’t have a problem with “guard”, and I have grown used to it, but I will give you that “ensure” is probably clearer. “ensure *this condition is true*”, “ensure that I can let foo = bar” — seems easier to conceptualize its meaning from syntax than “guard”…
> The only problem I have is that “ensure” exists in a different language I know (Ruby), where it has different meaning.
> So… I’m not sure it’s worth changing “guard” now and I probably wouldn’t be *for* the change, but I also probably wouldn’t argue against it either ;)
> — Radek

My thoughts are almost the same, except that I wouldn’t consider the fact that ensure means something different in Ruby to be a problem.  IMO, something like ‘always’ would have been a clearer keyword for what Ruby intended there anyway.


More information about the swift-evolution mailing list