Communicating between objects

Wow Alice. I think that is the most beautiful Rust I have seen since "Hello world".
So easy on the eyes, no syntactic clutter of lifetimes, generics or even traits.
But so cunning, splitting the actor into two structs and a free function.

The reason I'm gushing about it is that I was just starting to contemplate reorganising big mess of Rust, itself derived from a big mess of C#, and making it adabltable to various input and output interfaces: Serial port, raw socket, message que, whatever.

My preferred way to think of that is as a net of processes connected by channels. With various, selectable, input and output nodes. A chain of processing nodes in the middle. And the whole thing replicated and parallelized as many times as we have different data streams to handle.

Back in the day we called that Communicating Sequential Processes (CSP). Or it looks a lot like what Allen Kay had in mind when he point the phrase "Object Oriented Programming" with SmallTalk. (Always wondered why the OOP guys talked about "messages" when what they were actually doing was simply passing parameters to functions that happened to be methods, a totally different thing)

Seems somebody renamed it "Actors" along the way. Who knew?

So my mind turned to Tokio and channels.

Anyway, a big thanks for that heads up, just at the right moment!

1 Like