[swift-evolution] [Review] SE-0065 A New Model for Collections and Indices

Dave Abrahams dabrahams at apple.com
Mon Apr 11 14:36:19 CDT 2016

on Sun Apr 10 2016, Jacob Bandes-Storch <swift-evolution at swift.org> wrote:

> Minor questions after initial read-through:
> - Should the comment on {index,formIndex}(_:stepsFrom:) say what happens if the
> resulting index would be out of bounds? 

I don't think we should ever specify what happens when preconditions are
violated.  That brings into question how to evaluate the correctness of
a program.  If the behavior is specified, the program has every right to
depend on that behavior, and then it's meaningless to say “you violated a
precondition, so the program is broken.”

> Can these functions return Optional values, or can they be `throws`?

No, precondition violations should never be treated as conditions from
which execution can continue.

> - Can {index,formIndex}(_:stepsFrom:) be combined with the limitedBy: versions,
> such that the limit is an optional parameter with default value nil? For
> example:

No, due to language limitations: you can't put default arguments in
protocol requirements.

> public func index(n: IndexDistance, stepsFrom i: Index, limitedBy limit: Index?
> = nil)
> Jacob
> On Sun, Apr 10, 2016 at 2:45 PM, Chris Lattner via swift-evolution
> <swift-evolution at swift.org> wrote:
>         On Apr 10, 2016, at 2:41 PM, Chris Lattner
>         <clattner at apple.com> wrote:
>         Hello Swift community,
>         The review of "A New Model for Collections and Indices" begins now and
>         runs through April 18th. The proposal is available here:
>     The correct link is:
>     https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md
>     -Chris
>         Reviews are an important part of the Swift evolution process. All
>         reviews should be sent to the swift-evolution mailing list at:
>         https://lists.swift.org/mailman/listinfo/swift-evolution
>         or, if you would like to keep your feedback private, directly to the
>         review manager.
>         What goes into a review?
>         The goal of the review process is to improve the proposal under review
>         through constructive criticism and, eventually, determine the direction
>         of Swift. When writing your review, here are some questions you might
>         want to answer in your review:
>         * What is your evaluation of the proposal?
>         * Is the problem being addressed significant enough to warrant a change
>         to Swift?
>         * Does this proposal fit well with the feel and direction of Swift?
>         * If you have you used other languages or libraries with a similar
>         feature, how do you feel that this proposal compares to those?
>         * How much effort did you put into your review? A glance, a quick
>         reading, or an in-depth study?
>         More information about the Swift evolution process is available at
>         https://github.com/apple/swift-evolution/blob/master/process.md
>         Thank you,
>         -Chris Lattner
>         Review Manager
>     _______________________________________________
>     swift-evolution mailing list
>     swift-evolution at swift.org
>     https://lists.swift.org/mailman/listinfo/swift-evolution
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list