Live data from Hacker News

Swift Distributed Actors

swift.org

121–130 of 135 posts

Re: Swift Distributed Actors

#121

There is an existing, influential, paper called "A Note on Distributed Computing" that hugely influenced Java (and other) languages and frameworks that argued precisely against abstracting away remoteness . The Swift team seems to be challenging that thesis: "[U]nlike other concurrency models, the actor model is also tremendously valuable for modeling distributed systems. Thanks to the notion of location transparent…

Probably not a good idea to burden application programmers with having to annotate each message send with whether the receiver is on the current computer or another one in a Citadel. Since Actors can move between computers in a Citadel, such annotations are infeasible in practice. Of course, modularity, security, and performance should not be ignored.

This notion of an agent moving between computers has always been problematic for me to understand. If we accept that an agent ("actor") is a combination of code and state, and that code and state are both reducible to data, then an agent moving between computers is no more noteworthy than saying data moved between computers and that move engendered computation based on and over that data, which is a defined sequence of RPC calls: send code; send data; execute(code, data). What distinguishes an "actor" from passing scripts in RPC calls? I think it is a false conceptual paradigm: "actors" in general conceptual world carry their own processing ("mind") unit. This attribute is not reproducible in software.

So, if the Actor Model is in fact reducible to a complex RPC framework, the question remains if we should distinguish between RPC and local PC without throwing ~mystical bits about actors into the question.

In any event, I was wrong in my OP about Swift's approach: it is in fact the Waldo approach with distinct treatment of remote ops, except instead of annotations, it is language level support and instead of instrumenting existing code (ala Java byte codes), it is the compiler that writes the boiler plate for the underlying RPCs.

Re: Swift Distributed Actors

#122

Earlier quoted context omitted.

Even in traditional Actor model systems processes aren’t remote by default. They just allow you to reason about remote concurrency the same way you reason about it generally.

The Actors Abstraction does not require specification of computer boundaries.

Unless I’m missing something this is exactly what I was saying? I’m open to the possibility I’m missing something, but my understanding is that Actor boundaries are messenger boundaries and they can be remote, or local processes, or event loop routines, or plain local functions with no real concurrency. The abstraction/model only enforces that communication between them is consistent no matter the actor’s environment.

Re: Swift Distributed Actors

#123

Earlier quoted context omitted.

To be clear, I quite like Swift and did from day 1. Granted I’ve only tinkered with it. What I didn’t like was interacting with Cocoa APIs. I found it difficult to use Swift’s protocols and structs in a FP style, because Cocoa isn’t designed that way. I imagine this has gotten a lot better since, particularly with stuff like Swift UI. That said, I’d personally find Swift more compelling to use as a server language.

Cocoa uses classic MVC, and actually started from NextStep (last century). UIKit smoothed it out a bit, but it’s still MVC/OO, under the hood. SwiftUI was developed from the ground, up, to use FP concepts, and things like Protocol-Oriented Programming. I’m looking forward to learning it, but the fact that most of the Apple world runs on tech from a design that was developed in the 1980s, should be an object lesson in…

> We rubbish the past at our peril.

It’s not as if functional programming is newer or untested. The reason most of the Apple world continues to use these paradigms is because the codebases which do continue to exist. Inertia alone would keep ObjC around for another 20 years, and the software industry is almost totally rewrite-averse.

Anyway, the rest of your comment is exactly what I’m talking about: Swift and its value propositions just don’t match up with the things it has had to interop with. I’m hoping Apple actually dedicates resources to SwiftUI documentation and adoption, and that gradual uptake is enough to stop worrying about fitting Swift to highly stateful OOP APIs that weren’t designed for it.

Re: Swift Distributed Actors

#124
post #74

Earlier quoted context omitted.

The architects of IRIX would like a word with you.

The ex-architects of a dead UNIX, most likely busy with their macOS or Windows laptops in 2021. Really curious what success story they are about to tell me.

I meant that at-the-time (in the 1990s), IRIX had a cohesive desktop experience. While it wasn't as pretty as Windows 95, it was certainly usable and not unpleasant to look at.

Re: Swift Distributed Actors

#125

Earlier quoted context omitted.

I don't know if that's true. In the Scala and Java worlds, a library called Akka provides distributed actors as a library. As far as I know, what you describe isn't a limitation. See https://doc.akka.io/docs/akka/2.5.32/general/supervision.htm...

It is a limitation. If the VM on the other machine is killed, or kills the thread, you'll never know that happened, and why. Well, you can probably ping the process and what not :) Compare Erlang's error handling and monitors: https://erlang.org/doc/reference_manual/processes.html#error...

I would assume Erlang is doing some type of heartbeat at the runtime level. You can always do this in your protocol if you absolutely need to. I know that in Akka Cluster, you configure this to set the rules for a node to be considered alive in the cluster, and if it's dead, all the actors hosted on it will be considered dead, too.

In a distributed system, I'm pretty certain you cannot guarantee receipt of an expected message, no matter what you try to do.

Re: Swift Distributed Actors

#126

Earlier quoted context omitted.

Cocoa uses classic MVC, and actually started from NextStep (last century). UIKit smoothed it out a bit, but it’s still MVC/OO, under the hood. SwiftUI was developed from the ground, up, to use FP concepts, and things like Protocol-Oriented Programming. I’m looking forward to learning it, but the fact that most of the Apple world runs on tech from a design that was developed in the 1980s, should be an object lesson in…

> We rubbish the past at our peril. It’s not as if functional programming is newer or untested. The reason most of the Apple world continues to use these paradigms is because the codebases which do continue to exist. Inertia alone would keep ObjC around for another 20 years, and the software industry is almost totally rewrite-averse. Anyway, the rest of your comment is exactly what I’m talking about: Swift and its va…

> It’s not as if functional programming is newer or untested.

It's not about maturity. It's about suitability for the purpose.

FP is probably not ever going to be easier to use, but it is safer, and can be used to safely implement algorithms of greater complexity than other paradigms.

It needs to be coupled with a reactive, event-driven system (that has state, but the state can be hidden in end nodes or a model), in order to deliver a great UX; which, at the end of the day, is what this is all about.

You can't have UX without state. It's all about where the state is maintained, and how many copies of it need to be made, as the program executes.

For example, say we have a checkbox that reflects/controls the state of a variable in our calculation. The on/off state is important. If it is on, let's say that we will introduce a compensating coefficient. If it is off, that coefficient is not applied to the function.

The state is not a part of the function, so it doesn't make sense to incorporate it (or even knowledge of the existence of that state) into the function.

Nevertheless, it is a crucial component of the user experience, and needs to be maintained somewhere.

The best bet may be to try to keep the state in the checkbox object, itself, and query it at runtime, or use a messaging system to be informed of state changes. I've always found a central model to be annoying. If the UX is at all complex, the model can get crazy, and turn into a richly productive bug farm.

Federated/franchised state can have its own issues, like when there's a lot of interaction/dependency between state nodes. That can get crazy, too, and difficult to debug.

So far, no one has come up with a perfect pattern, but I kind of like the idea of a "composer" pattern, that queries federated states, and "weaves" them together, at runtime, as opposed to a model that sends directives out to a set of nodes.

The issue that lots of folks have with OO, is polymorphism. That is not really the same thing. It can make discovering an algorithm difficult, as functionality can cascade through a whole bunch of levels, and debugging can be a real pain in the butt. If anyone has had sticky CSS specificity issues, they have an idea of what it can be like to grope around in a polymorphic codebase.

Protocol-oriented programming is not a panacea, either. This is especially true, when mixed with polymorphism. I wrote about a strange issue I encountered, here[0].

But polymorphism isn't bad. It's just a tool, and we don't use a nailgun as a hammer. Like so many tools, people have tried to shoehorn it into unsuitable configurations, and refuse to consider other, more suitable tools. I see FP proponents, doing the same thing.

Swift is nice, because it has a rich toolbox, allowing us to select the right tool, for the right job, without having to do complex linking games between libraries of different languages.

[0] https://littlegreenviper.com/miscellany/swiftwater/the-curio...

Re: Swift Distributed Actors

#127
post #74

Earlier quoted context omitted.

The ex-architects of a dead UNIX, most likely busy with their macOS or Windows laptops in 2021. Really curious what success story they are about to tell me.

I meant that at-the-time (in the 1990s), IRIX had a cohesive desktop experience. While it wasn't as pretty as Windows 95, it was certainly usable and not unpleasant to look at.

4Dwm was just another Motif derived desktop with all the technical downsides I was referring to.

Re: Swift Distributed Actors

#128
post #56

Question for folks: where do server-side Swift folks hang out? I've been writing server-side / enterprise code in Swift for about a year now, and the language has really grown on me. But it's a small community, and IBM's & Google's departures were a big blow to the feeling of inevitable growth to it. I'd love to find a watering hole to chat with others in the same small niche.

Here's an invite for the main Swift server Slack that's not just Vapor https://join.slack.com/t/swift-server/shared_invite/zt-5jv0m...

Re: Swift Distributed Actors

#129
post #116

Earlier quoted context omitted.

Gosu's roadmap... copy .NET and Groovy Kotlin's roadmap... Copy Gosu and Groovy Java's roadmap... Make Gosu, Groovy and Kotlin redundant by supporting the idioms of Gosu and Kotlin eventually and force those languages to 'nativize' their underlying implementations. Manifold's roadmap... Ditch Gosu on the JVM and make a java library, copy all the stuff Java doesn't' have a plan for like .Net's (and by extension Gosu's…

Ah yes, that's exactly what the slave owners said before the civil war - look at the product we are delivering, and everyone else's doing it too! Their argument was so compelling that we decided to keep having slaves.

That might be the worst analogies I've ever heard. Humans extracting value asymmetrically out of captive humans has nothing to do with new syntactical features and/or sugar of other languages that language developers are inspired implement to implement in their own language because they solve modern workflow. And those developers are well compensated for for their contributions being by monetary, notoriety or self satisfactory means.

Re: Swift Distributed Actors

#130

Earlier quoted context omitted.

In my last job until I retired this year, I spent 5.5 years writing only Swift at a large (not FAANG) company. It took the entire mobile team about that time to retire most of the Obj-C codebase(s). Swift is by far my favorite language despite having spent decades with C/C++/Java and Obj-C. I am still writing Swift despite being retired but as part of my art generation work now.

> I am still writing Swift despite being retired but as part of my art generation work now. Anything publicly available? I’m always looking for more generative art!

twitter @digconart

not selling yet, but there is lots there

Post reply on HN