News for hackers. Stuff that matters.
Re:Swift Actors: A practical example, part 1 by tcldr on Tuesday May 11, 2021 @05:07AM (#27115889)
I'm also intrigued where the Actor model will leave Combine. Are they designed to work together?

Many of the Rx based architectures (The Composable Architecture in Swift, React, Cycle.js, etc) that have appeared – all inspired by Elm (itself inspired by Erlang/OTP?) – seem to lean on a kind of pseudo actor model where messages are passed into a kind of 'actor', its state is modified, side-effects are initiated and performed asynchronously, and subscribers are updated in turn.

With the Rx based architectures at least this created a lot of boiler plate and the need to create a separate enum just to pass messages into the monad with a big switch statement to route them all.

Now, if I understand correctly, this actor model would facilitate a very similar workflow but without an additional dependency and far less boilerplate.

Instead of passing messages into the 'actor' via a messages stream – you can just call methods on the actor. Then, an actor can manage a 'state' property internally and simply forward changes to that state to via a publisher (PassthroughSubject/BehaviorSubject).

That would be pretty nice!

Re:Swift Actors: A practical example, part 1 by jb1991 on Tuesday May 11, 2021 @05:13AM (#27115920)
> all inspired by Elm

No, Elm is just another implementation, not the invention.

Re:Swift Actors: A practical example, part 1 by tcldr on Tuesday May 11, 2021 @05:53AM (#27116151)
Well, it seems to me that the creators of the mentioned frameworks cite Elm as their inspiration – even if it wasn't the genesis of the concept.
Re:Swift Actors: A practical example, part 1 by jb1991 on Tuesday May 11, 2021 @06:44AM (#27116440)
One of those frameworks you mentioned is React, so that’s not quite true. Elm is cited in things like Redux, but React was first deployed on the Facebook website a year or more before Elm was even first released. And FRP has been around much longer.
Re:Swift Actors: A practical example, part 1 by tcldr on Tuesday May 11, 2021 @08:06AM (#27117067)
Yes, I meant Redux specifically, and all the other Elm derivative frameworks. I think that was clear.
Re:Swift Actors: A practical example, part 1 by jb1991 on Tuesday May 11, 2021 @08:19AM (#27117170)
> I think that was clear.

Not really. You didn't mention Redux and you explicitly mentioned React, hence my clarification.

Re:Swift Actors: A practical example, part 1 by weehoo on Tuesday May 11, 2021 @05:31AM (#27116010)
What is the invention? Honest question, not familiar with this stuff. Comments make it hard for non-experts to follow the discussion.
Re:Swift Actors: A practical example, part 1 by tempodox on Tuesday May 11, 2021 @05:35AM (#27116030)
Re:Swift Actors: A practical example, part 1 by ProfHewitt on Tuesday May 11, 2021 @02:29PM (#27121679)
Unfortunately, the Wikipedia article (that I wrote many years ago) is way out of date :-(

See the following for Actors:

https://papers.ssrn.com/abstract=3418003

Re:Swift Actors: A practical example, part 1 by jb1991 on Tuesday May 11, 2021 @05:37AM (#27116045)
With regards to Elm and some others, you have Functional reactive programming, reactive programming, Rx, it goes by a variety of names. It’s most famous for transforming UI development some 8? 10? years ago with the widespread adoption of React. But it’s been around longer in various forms. Implementations can widely vary but the general concepts are very similar.

Actors are something different.

Re:Swift Actors: A practical example, part 1 by mojuba on Tuesday May 11, 2021 @11:10AM (#27119006)
I'm also wondering whether SwiftNIO will be rewritten to use actors, or it will stay "old-school" for the sake of efficiency. Very much looking forward to Swift maturing for backend development either way.

It's an amazing, rich language with the only drawback of the compiler being shamefully slow (though it's probably not that bad on Linux, where there are no legacy ObjC frameworks). Other than that, I love the idea of having an ARC-based modern type-safe language on the backend, possibly with the new concurrency model being at the core of the network framework.