3 ms·
IMHO mutable global state is totally fine if it is scoped to the current module or source file. Of course then it's not really 'global' anymore ;) Immutable gl
by flohofwoe 2y ago
IMHO mutable global state is totally fine if it is scoped to the current module or source file. Of course then it's not really 'global' anymore ;)
Immutable global state is fine to be accessible from the whole code base.
Pure functions are best of course, but you can't build real-world things entirely from pure functions.
The problematic approach lives somewhere inbetween, passing context/object references into deep callstacks isn't really a good solution for anything.
- louthy 2y ago> Pure functions are best of course, but you can't build real-world things entirely from pure functions. That's just plain wrong. There's even a language built entirely around pure functions: Haskell.
- flohofwoe 2y agoHow do you talk to typical OS-, IO- or GUI-APIs (which all essentially represent global mutable state) in Haskell with pure functional code?