2 ms·
Good article. Yes, the idea of purity becomes less useful in OO languages. That's not specific to JavaScript or even to dynamic typing. Try summing the elements
by cousin_it 10y ago
Good article. Yes, the idea of purity becomes less useful in OO languages. That's not specific to JavaScript or even to dynamic typing. Try summing the elements of a Collection<Integer> in Java and your code will also be impure, because Collection is an interface whose implementation can do anything. I agree that JS goes too far in allowing you to impersonate numbers, but most real-world code uses interfaces in some way, so you can't make it pure without changing your language into Haskell.