Pure functions in Mamba are almost pure, but not quite.
Namely, while we disallow reading from global mutable variables, we do still allow writing to mutable variables outside the function, which is still a side-effect.
The question is, do we want to disallow this?
While this would make functions pure by definition, it would perhaps also decrease their usability.
My main concern is that while this feature would be nice, it is perhaps too cumbersome to use resulting in developers not using the feature at all.
I often see discussions about functional programming languages, and how they are safe, but that they are also often too restrictive, resulting in them not being used at all.
I think this discussion is somewhat similar to such discussions.
Do we wish to be pragmatic, and make functions "almost pure", or do we want to make them truly pure?
Issue, or potential issue
Pure functions in Mamba are almost pure, but not quite. Namely, while we disallow reading from global mutable variables, we do still allow writing to mutable variables outside the function, which is still a side-effect.
The question is, do we want to disallow this? While this would make functions pure by definition, it would perhaps also decrease their usability. My main concern is that while this feature would be nice, it is perhaps too cumbersome to use resulting in developers not using the feature at all.
I often see discussions about functional programming languages, and how they are safe, but that they are also often too restrictive, resulting in them not being used at all. I think this discussion is somewhat similar to such discussions. Do we wish to be pragmatic, and make functions "almost pure", or do we want to make them truly pure?