Skip to content
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

[SR-3780] UnsafeXXXBufferPointer should be its own SubSequence type #46365

Closed
dabrahams opened this issue Jan 29, 2017 · 8 comments
Closed

[SR-3780] UnsafeXXXBufferPointer should be its own SubSequence type #46365

dabrahams opened this issue Jan 29, 2017 · 8 comments
Assignees
Labels
feature A feature request or implementation good first issue Good for newcomers standard library Area: Standard library umbrella will not do Resolution: Will not be worked on

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-3780
Radar None
Original Reporter @dabrahams
Type Bug
Status Closed
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, StarterBug, StarterProposal
Assignee @dabrahams
Priority Medium

md5: e4fcaeeef82714e215544c3d2b388c2a

Issue Description:

It's inconvenient to slice one of these things and get some anonymous slice wrapper type, and there's no reason that should happen. Instead, UnsafeXXXBufferPointer should be its own SubSequence type

@belkadan
Copy link
Contributor

I thought we decided it can't do that because the indexes of the slice won't match the indexes of the base.

@dabrahams
Copy link
Collaborator Author

...and someone really insists that we have zero-based integer indexing for these; bleah. Maybe it would be acceptable to change the indices to pointers; then you could always do buffer.startIndex[n]

@belkadan
Copy link
Contributor

That works as long as you don't expect people to use integer subscripts.

@dabrahams
Copy link
Collaborator Author

I'm not convinced it's super important to support that directly. To be fair, though, part of the idea was that you could transform your Array algorithm to use withUnsafeBufferPointer and transplant the body of the algorithm into the closure without changes. Using pointer indices would foil that, though we could probably offer fixits.

@belkadan
Copy link
Contributor

I tend to agree with you. Just wanted to make sure it was addressed if anyone made the proposal. (We'd also still have to support some integer operations for backwards compatibility.)

@dabrahams
Copy link
Collaborator Author

If we supported those integer operations with the same syntax we currently use, we would break the semantics of programs.

@belkadan
Copy link
Contributor

Hm. :-/ Then someone's going to have to be very clever about Swift 3 compatibility.

@dabrahams
Copy link
Collaborator Author

Ben's convinced me that being a drop-in replacement for Array is important. Giving up on this one now :-)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2022
@AnthonyLatsis AnthonyLatsis added feature A feature request or implementation will not do Resolution: Will not be worked on and removed bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. StarterProposal labels Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation good first issue Good for newcomers standard library Area: Standard library umbrella will not do Resolution: Will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants