-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Safe Access to Contiguous Storage #2307
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Alex Martini <[email protected]>
|
||
## <a name="Indexing"></a>Appendix: Index and slicing design considerations | ||
|
||
Early prototypes of this proposal defined an `Index` type, `Iterator` types, etc. We are proposing `Int`-based API and are deferring defining `Index` and `Iterator` until more of the non-escapable collection story is sorted out. The below is some of our research into different potential designs of an `Index` type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are okay with having an Index
type on Span
, and we must be proposing it above. (UnsafeBufferPointer
has sunk the concrete concept of an Index
down into the ownership model in SE-0437. Whatever shape we will propose for a collection-like container of noncopyable elements, it will include the idea of an escaping Index
, with this exact name.)
(Iterator
on the other hand is not the right name for a borrowing iterator type, as the classic Sequence
protocol reserves this name for its unified borrowing+consuming iterator. That iterator shape does not translate to the ownership model. Sequence
will be split into two+ variants, with each variant coming with a distinct name for its iterators. Span
will soon need to define a borrowing iterator type; however, this work must be deferred until we have introduced that concept -- the addition should be done in that same proposal.)
Co-authored-by: Karoy Lorentey <[email protected]>
The state of the compiler does not allow us to propose it at this time.
This is a proposal for safe access to borrowed memory, formerly known as "BufferView".
This proposal is a companion to (and depends on) Non-Escapable Types and on Lifetime Dependency Annotations for Non-escapable Types.