To sum up my own difficulties with the pointers API:
-
They are all named "unsafe", but some are more unsafe than others.
Look no further than above for one example.
-
Swift pointers create an "axiomatic" system of guarantees against know traps, but both axioms and traps are obscure/unknown to many developers, and practical problem solving need theorems more than axioms.
Many developers are looking for an Arithmetic Rope on their desk, rather than a copy of Euclid's Elements in their bookshelf. The first is easy to use and never lies, when the latter requires you to derive proofs (and make mistakes on the way).
-
In the traps I can remember from memory (aliasing, wrong alignment, uninitialized memory, the difference between assumingMemoryBound and bindMemory and the rationale behind it, short-lived pointers, ...), some are "classic" (can be found in other languages, and Googled), and some are specific to Swift (surprise!).
I totally dig that a sane and sound "axiomatic" system needed to be built first. But what's next? Who will derive the few simple and useful theorems that will make pointers easy to use?