Skip to content

Comment on Concurrent Programming, with Examplesparent

Comments

What you heard is correct. If you have pure functions and provided, that you have working primitives of concurrency, you can go to any place in you code, where you call a pure function and change the code, so that the function runs in a new concurrency (or parallelism) primitive. For example in a new thread or process. The places where this is useful can be discovered by profiling.

Another advantage is, that you can unit test each function on its own, without setting up a whole host of preconditions. That's because of referential transparency.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.