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-12739] Document Swift Memory Model and UnsafePointer #55184

Open
atrick opened this issue May 6, 2020 · 1 comment
Open

[SR-12739] Document Swift Memory Model and UnsafePointer #55184

atrick opened this issue May 6, 2020 · 1 comment
Assignees
Labels
standard library Area: Standard library umbrella task

Comments

@atrick
Copy link
Member

atrick commented May 6, 2020

Previous ID SR-12739
Radar rdar://18542360
Original Reporter @atrick
Type Task
Additional Detail from JIRA
Votes 2
Component/s Standard Library
Labels Task
Assignee @atrick
Priority Medium

md5: 375ebdd2ecb596d6714efdeae73106a8

Issue Description:

The purpose of this bug is to gather feedback and suggestions for information that should be included in the documentation and how it should be presented.

Several related areas of the Swift memory model need documentation beyond the evolution proposals and API docs:

  • Basic semantics: allocation, alignment, (de)initialization, type-bound memory

  • Typed vs untyped (raw) pointers

  • Type safety, type conversions, and rebinding memory types

  • Expected usage of Unsafe[Mutable]Raw[Buffer]Pointer

  • Expected usage of "memory binding" APIs

  • C interoperability

I'm not sure how much, if any, of this documentation should be part of a formal evolution process. But, let's first focus on writing it down somewhere. Currently, we many forum posts, and only sparse formal documentation:

[UnsafeRawPointer SE-0107](https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md).

[Memory Model Introduced by SE-0107](https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md#memory-model-explanation)

[Unsafe[Mutable]RawPointer API](https://github.com/apple/swift/blob/master/stdlib/public/core/UnsafeRawPointer.swift)

[UnsafeRawPointer Migration Guide](https://swift.org/migration-guide-swift3/se-0107-migrate.html)

[SE-0138](https://github.com/apple/swift-evolution/blob/master/proposals/0138-unsaferawbufferpointer.md) and the [doc comments](https://github.com/apple/swift/blob/master/stdlib/public/core/UnsafeRawBufferPointer.swift.gyb)

[UnsafeRawPointer doc comments](https://github.com/apple/swift/blob/master/stdlib/public/core/UnsafeRawPointer.swift)

[Andy's unofficial working document on type safety](https://github.com/atrick/swift/blob/type-safe-mem-docs/docs/TypeSafeMemory.rst)

@amomchilov
Copy link
Contributor

For future archaeologists, here's a WWDC 2020 video that went into this stuff in detail: Safely manage pointers in Swift

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard library Area: Standard library umbrella task
Projects
None yet
Development

No branches or pull requests

2 participants