[swift-evolution] repeat loop enhancement

Chris Lattner clattner at apple.com
Tue Dec 8 23:58:31 CST 2015

On Dec 8, 2015, at 4:43 PM, Daniel Steinberg via swift-evolution <swift-evolution at swift.org> wrote:
> For me this comes up when teaching children or new programmers. (Perhaps not a valid use case)

This is a very valid use case.

FWIW, “repeat N {}” was originally designed and scoped into the Swift 2 implementation of the feature, but was cut due to schedule limitations.  There is precedent for this sort of feature in many teaching oriented languages (e.g. Logo).

I’d say that the pro’s and con’s of this are:

+ Makes a simple case very simple, particularly important in teaching.
+ Even if you aren’t familiar with it, you can tell at first glance what the behavior is.
- It is “just syntactic sugar”, which makes the language more complex.
- It is a very narrow feature that is useful in few practical situations.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151208/95be8ce4/attachment.html>

More information about the swift-evolution mailing list