AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
Functional Programming for Threads and Locks
Functional programming solves the problem not by avoiding sharing but by avoiding mutable state. So if you're in a situation where as soon as you have written something to memory, it will never change and that's what a pure functional language guarantees. It's impossible for a thread to modify data that's being created by another thread because no part of the program can ever modify data. That's what functional programming is all about, is avoiding mutation. Right. And how does functional programming come into the picture when it comes to like thread and locks? Sure. I want to take a setback maybe before we talk about that and talk about why threads and locks have problems. And it basically boils down to