@Dan Cook “Synchronization is only a problem in programs which allow shared mutable state,
and parallel execution. Get rid of one or the other, and suddenly you don’t need synchronization mechanisms like locks, semaphores, mutexes, etc.”
Yes, that is totally true, but unfortunately I meant something a little bit different by “Synced” / “Synced needed.” 🙂 (I intentionally tried to omit the word synchronization, but the meaning I’ve been looking for is too similar…)
Let me clarify. Earlier we had a discussion on the negative sides of FP and one point was something like “OO preserves identity, FP does not”
@shalabh. The point is that you might get rid of shared mutable state but then to “preserve identity” you have to make it up “by hand”.
No matter what, if there are 2 independent pieces of code (like objects) which both use the same piece of information (the same identity), then there must be some kind of “syncronization” which prevents the system to work on corrupt data (without sync).
Sure, one option is using references to the same memory address, but then the two objects are not really independent but coupled. If they are truly independent then the syncronization of “their common state” must be embedded in their communication (protocol).
The “protocol between communicating objects”/“mechanisms of the system” must ensure the sequences of events are valid between all objects. My idea is to define both
valid
and
invalid
sequences of messages in the system so we can check out if some sequence (pattern) is left out, because in theory we are able to generate all the different kinds of sequences - expressing them with patterns. This really seems like connecting state machines, but still I did not find a well-known project which uses something like that. My closest findings are
xstate
library (Typescript) and some SAT solvers coming from the CTL branch of Temporary Logic.