[swift-evolution] [pitch] rename 'guard' to 'ensure'
David Sweeris
davesweeris at mac.com
Thu Oct 27 08:40:39 CDT 2016
> On Oct 27, 2016, at 08:21, Jay Abbott <jay at abbott.me.uk> wrote:
>
> You’re really in pun mode today, David! :)
>
It's the best mode 😎
> But I do really like Marco’s suggestion of guard: because it changes the interpretation…
>
> guard: x > 0 else { return }
> This now reads as: This is a guard: x must be greater than zero, otherwise return. The only issue is it has the same syntax as a break-label so becomes potentially ambiguous/confusing. Is there another way that could be achieved?
>
The ambiguity could be resolved by disallowing keywords as labels. I don't use them much, though, so I'm not sure how much that would affect readability.
- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161027/fe346bb4/attachment.html>
More information about the swift-evolution
mailing list