Skip to content

[5.7][stdlib][docs] Clarify BidirectionalCollection requirements #58544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2022

Conversation

lorentey
Copy link
Member

(Cherry picked from #58403)

  • Explanation:
    As discussed on the forum, BidirectionalCollection requirements as currently stated can be interpreted to forbid conforming types from accepting indices that lie between valid (i.e., reachable) indices in the collection. Among other undesirable effects, this interpretation would render SE-0180 (String.Index overhaul) incompatible with these requirements.

    Update the wording to clarify that the requirements only apply to valid indices. (Collection protocols do not constrain the behavior of invalid indices — it’s up to individual collection types to implement them as they wish.)

  • Scope: This is a documentation update with no code changes.

  • Risk: Minimal.

  • Issue: rdar://92297280

  • Testing: n.a. (regular PR tests)

  • Reviewer: @stephentyrone

As discussed on the forum, `BidirectionalCollection` requirements as
currently stated can be interpreted to forbid conforming types from
accepting indices that lie between valid (i.e., reachable) indices
in the collection. Among other undesirable effects, this
interpretation would render SE-0180 (String.Index overhaul)
incompatible with these requirements.

Update the wording to clarify that the requirements only apply to
valid indices. (Collection protocols do not constrain the behavior of
invalid indices — it’s up to individual collection types to implement
them as they wish.)

https://forums.swift.org/t/string-index-unification-vs-bidirectionalcollection-requirements/55946
rdar://92297280
(cherry picked from commit b8cbd4f)
@lorentey lorentey requested a review from a team as a code owner April 29, 2022 21:26
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey lorentey added r5.7 standard library Area: Standard library umbrella documentation labels Apr 29, 2022
@lorentey lorentey requested a review from airspeedswift May 10, 2022 18:41
@lorentey lorentey merged commit 2e1da48 into swiftlang:release/5.7 May 19, 2022
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.7 labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 🍒 release cherry pick Flag: Release branch cherry picks standard library Area: Standard library umbrella swift 5.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants