| ▲ | halfmatthalfcat 20 hours ago | |||||||||||||||||||||||||||||||
I loved the idea of Swift adopting actors however the implementation seems shoehorned. I wanted something more like Akka or QP/C++... | ||||||||||||||||||||||||||||||||
| ▲ | Someone 19 hours ago | parent | next [-] | |||||||||||||||||||||||||||||||
I feel the reverse. I can see one can claim Swift has everything but the kitchen sink, but its actors, to me, don’t look shoehorned in. Reading https://docs.swift.org/swift-book/documentation/the-swift-pr..., their first example is:
Here, the ‘actor’ keyword provides a strong hint that this defines an actor. The code to call an actor in Swift also is clean, and clearly signals “this is an async call” by using await:
I know Akka is a library, and one cannot expect all library code to look as nice as code that has actual support from the language, but the simplest Akka example seems to be something like this (from https://doc.akka.io/libraries/akka-core/current/typed/actors...):
I have no idea how naive readers of that would easily infer that’s an actor. I also would not have much idea about how to use this (and I _do_ have experience writing scala; that is not the blocker).And that gets worse when you look at Akka http (https://doc.akka.io/libraries/akka-http/current/index.html). I have debugged code using it, but still find it hard to figure out where it has suspension points. You may claim that’s because Akka http isn’t good code, but I think the point still stands that Akka allows writing code that doesn’t make it obvious what is an actor. | ||||||||||||||||||||||||||||||||
| ▲ | whalesalad 19 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||
Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang. - Robert Virding | ||||||||||||||||||||||||||||||||
| ▲ | jen20 20 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||
> I wanted something more like Akka https://github.com/apple/swift-distributed-actors is more like Akka, but with better guarantees from the underlying platform because of the first-class nature of actors. | ||||||||||||||||||||||||||||||||
| ▲ | troupo 19 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||
> the implementation seems shoehorned. Because it's extremely hard to retrofit actors (or, really, any type of concurrency and/or parallelism) onto a language not explicitly designed to support it from scratch. | ||||||||||||||||||||||||||||||||
| ▲ | ModernMech 19 hours ago | parent | prev [-] | |||||||||||||||||||||||||||||||
This is my feeling as well. It feels to me that based on the current product, Swift had two different designers: one designer who felt swift needed to be a replacement for Objective C and therefore needed to feel like a spiritual successor to that language, which meant it had to be fundamentally OOP, imperative, and familiar to iOS devs; and another designer who wanted it to be a modern functional, concurrent language for writing dynamic user interfaces with an advanced type checker, static analysis, and reactive updates for dynamic variables. The end result is a language that brings the worst of both worlds while not really bringing the benefits. An example I will give is SwiftUI, which I absolutely hate. You'd think this thing would be polished, because it's built by Apple for use on Apple devices, so they've designed the full stack from editor to language to OS to hardware. Yet when writing SwiftUI code, it's very common for the compiler to keel over and complain it can't infer the types of the system, and components which are ostensibly "reactive" are plagued by stale data issues. Seeing that Chris Lattner has moved on from Swift to work on his own language, I'm left to wonder how much of this situation will actually improve. My feeling on Swift at this point is it's not clear what it's supposed to be. It's the language for the Apple ecosystem, but they also want it to be a general purpose thing as well. My feeling is it's never not going to be explicitly tied to and limited by Apple, so it's never really going to take off as a general purpose programming language even if they eventually solve the design challenges. | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||