4 ms·
The Unsafe API has existed since Swift 1 which predates Graydon joining, and `UnsafeSendable` is just following the language naming conventions.
by trevor-e 5y ago
The Unsafe API has existed since Swift 1 which predates Graydon joining, and `UnsafeSendable` is just following the language naming conventions.
- monocasa 5y agoPerhaps this is exposing a gap in my knowledge of programming language history, but I'm not aware of other languages that mark types as threadsafe with an otherwise empty Send(able) implementation.
- pjmlp 5y agoSee Concurrent Haskell as possible set of ideas how typeclasses can be used to constrain the set of operations and sequences a type can perform.
- monocasa 5y agoBut that's pretty different, since normal code in that context uses immutable data structures and the channels, etc. are language features. You then don't have to tack something like Send(able) onto arbitrary types because they're immutable anyway. The whole point of Send(able) is thread safety in the face of generally mutable state in contrast to something like Concurrent Haskell.
- pjmlp 5y agoThe idea is already there, the rest are details. It is like arguing Rust invented affine types while ignoring the ideas in Cyclone and linear typing, even if they don't map 1:1 to what Rust has.
- monocasa 5y agoAffine types are a version of linear types. Concurrent Haskell doesn't use typeclasses to constrain what data can be passed between threads. All data can be in Concurrent Haskell because all data is immutable anyway. It's a fundamentally different concept, not a slightly different subset like affine/linear types.
- dwaite 5y agoSendable can also be equated to serializable once you are going cross-process. In that sense you see usage in systems like CORBA and RMI, and so systems that broadly aim to make things sendable like Erlang.