2 ms·
Let's not forget that if you are not passing immutable data-structures into your pure functions, all bets are off. Unless you code very defensively, there's no
by beders 8y ago
Let's not forget that if you are not passing immutable data-structures into your pure functions, all bets are off.
Unless you code very defensively, there's no way you can guarantee purity, especially in async programming.
Given f(x) = y, if x is a regular JS object, you can't guarantee purity. It works many times because of the single-threaded nature of most JS engines, but the moment you do something async, you can't guarantee x hasn't changed.
That's one of the many reasons I like ClojureScript. It offers interesting guarantees that let me write robust code.