On Monday 07 September 2015 12:40, Bahman Movaqar wrote: > It seems to me a good practice to mark all functions that I write > as `pure` and define all the variables as `immutable`, unless > there is a reason not to.
I agree. > I can see some serious advantages of this, most notable of which > is minimum side-effect and predictability of the code. However I > suppose it's going to impact the performance and memory footprint > as well, though I have no idea how deep the impact will be. I don't see how merely marking things immutable/pure would affect performance negatively. They're just marks on the type. If anything, you could get a performance boost from the stricter guarantees. But realistically, there won't be a difference. If you change your algorithms to avoid mutable/impure, then you may see worse performance than if you made use of them. But I suppose that would be "a reason not to" mark everything immutable/pure.