6 ms·
That combined with marking types as Sendable points strongly at Rust influence. Then when you know that literal Graydon Hoare is working at Apple on Swift, the
by monocasa 5y ago
That combined with marking types as Sendable points strongly at Rust influence. Then when you know that literal Graydon Hoare is working at Apple on Swift, the Rust influence is undeniable.
- trevor-e 5y agoThe 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.
- saagarjha 5y agoIs he still working there? It doesn’t really look like he is.
- monocasa 5y agoMy sense is that was a recent change, a feature as integral to internal design f the language would be baking for while, and you would expect his influence to outlast his presence.
- stephencanon 5y agoGraydon has been off doing other things for a while now. Off the top of my head, I think he left in 2019. I miss working with him, but there are lots of folks involved with Swift who think really deeply about this stuff. No complex feature is the work of any one person in isolation.
- pjmlp 5y agoUnsafe monads were already a thing in Haskell. Sendable is just yet another monadic type, or a ML functor.
- glowcoil 5y agoThere is really no way in which Rust's Send or Swift's Sendable form a monad or a functor in any of the senses of those terms.
- pjmlp 5y agoThat doesn't change the fact that Haskell and ML did it first on their type systems, regardless how pedantic we want to discuss type theory.
- glowcoil 5y agoThe things you are saying are just not true. Standard ML and OCaml are in fact single-threaded languages, and while Haskell has concurrency and parallelism support it does not have anything that looks particularly like a Send or Sendable trait.
- pjmlp 5y agoConcurrent ML: http://cml.cs.uchicago.edu/pages/sync-var.html http://cml.cs.uchicago.edu/pages/sync-var.html As for the rest I am on the go to type a proper example.
- glowcoil 5y agoYes, Concurrent ML exists. It also, however, does not have any feature analogous to Rust's Send trait or Swift's Sendable protocol.
- pjmlp 5y agoOf course it doesn't have a type class Sendable, that is not the point, rather the type theory behind it, and what those languages allow for, regardless of what they have in 2021 on their standard library.