Hey Chris,
APIs don't exist in a vacuum. It must be possible to productively use them to solve real-life problems.
Can you please show me a piece of code solving some toy problem that uses pointer-based atomics without separate heap allocations for every atomic value? I've been looking at this for (on and off) half a year now, but I have so far failed to make an example that isn't broken, ridiculously overcomplicated or both. (There is a reason why the proposal doesn't show how to implement inline storage through ManagedBuffer
or MemoryLayout.offset(of:)
.) Something like the proposal's silly lock-free single-consumer stack should be enough to illustrate how these APIs will work in practice.
I believe ManagedAtomic
is the sweet solution that lets us move ahead until the language matures. Again, for the two or three full-time Swift engineers who think they may able to directly use pointer-based APIs, they will be available as public-but-underscored methods. Trying to document how they work is a fool's errand at this point.
There is plenty of room to expose pointer-based APIs in followup proposals, as soon as it becomes possible to responsibly do so.
Thanks,
Karoy