swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.32k stars 10.34k forks source link

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

Open atrick opened 4 years ago

atrick commented 4 years ago
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:

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 commented 3 years ago

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