5 ms·
> The protocol states that all actors must also be Sendable, which is another new important piece of the concurrency proposal. This protocol has no actual code,
by msdrigg 5y ago
> The protocol states that all actors must also be Sendable, which is another new important piece of the concurrency proposal. This protocol has no actual code, and its purpose is to "mark" which types are safe to use in a concurrent environment.
It looks like Swift is taking pointers from Rust. Specifically Rust's send/sync traits. There's even other keywords like unsafe in Swifts new `UnsafeSendable` for Sendable types that bypass compile time checks.
- correct_horse 5y agoUnsurprising, since the creator of rust, Graydon Hoare now works for apple on swift[0] in "a non-leadership position". [0] https://old.reddit.com/r/rust/comments/7qels2/i_wonder_why_graydon_hoare_the_author_of_rust/ https://old.reddit.com/r/rust/comments/7qels2/i_wonder_why_g...
- fay59 5y agoI believe that Graydon left Apple a while ago, but following compiler Twitter, it’s pretty clear that the rust folks and Swift folks are usually in good terms.
- monocasa 5y agoYou don't by chance know a list of handles to follow to get started following "compiler Twitter"?
- fay59 5y agoI would recommend @johnregehr, @shafikyaghmour and @trav_downs if you're new to the area. If you're particularly interested in rust, @myrrlyn, @ManishEarth and @steveklabnik are great follows. @jfbastien is a compiler dad-joker extraordinaire and @jckarter is a master shitposter (with a side of old Macs) if you're in need of compiler-oriented comic relief. In particular, John tends to get involved in a lot of interesting conversations, so he's great to find more people to follow.
- jamil7 5y agoI believe a few apple employees also contribute to Rust right? Seems to be quite a bit of crossover.
- codetrotter 5y agoSwift and Rust have a very similar feel to them, and I love both of them. There is no doubt that there is a lot of cross pollination between the two. And at least one person that was involved in creating Rust now works on developing the Swift language.
- jamil7 5y agoCan you comment on compile time for both in your experience? Larger Swift and SwiftUI projects are bring my (new) mac to a grinding halt and I’m finding myself working around things I know will be difficult for the compiler.
- terhechte 5y agoI'm using both a lot. Rust has better compile times than Swift. It is especially not prone to these "one expression takes 60 seconds" scenarios. Although I feel that things have improved considerably with Xcode 13 beta. On the Rust side, there's an (almost-done) alternative compiler backend called Cranelift that brings 30-50% faster compile times for debug builds. This improves the iteration time considerably. https://news.ycombinator.com/item?id=25130528 https://news.ycombinator.com/item?id=25130528
- pjmlp 5y agoThe concept of unsafe keywords in systems programming languages goes back all the way to 1960. Rust might have brought many interesting concepts into mainstream, however unsafe wasn't one of them.
- monocasa 5y agoThat 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.
- saagarjha 5y ago> There's even other keywords like unsafe in Swifts new `UnsafeSendable` for Sendable types that bypass compile time checks. Swift has used the “Unsafe” prefix for a very long time to indicate things that break its safety model, see for example the UnsafePointer APIs.
- layer8 5y agoUsing empty interfaces (protocols) as markers is a longstanding practice in Java [0], although nowadays it is considered an antipattern and annotations are preferred. [0] https://en.wikipedia.org/wiki/Marker_interface_pattern https://en.wikipedia.org/wiki/Marker_interface_pattern
- tomovo 5y ago> taking pointers from Rust Surely you meant borrowing.