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

Vanderlei Martinelli vmartinelli at alecrim.com
Wed Feb 24 12:33:35 CST 2016


guard !guardKeywordIsRenamedToSomethingElse else { return nil }

-1

On Tue, Feb 23, 2016 at 5:52 PM, Matt Whiteside via swift-evolution <
swift-evolution at swift.org> wrote:

>
> > 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.
>
> Matt
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160224/1984bee2/attachment.html>


More information about the swift-evolution mailing list