3 ms·
The opposite would be better: an "impure" keyword for specifying impure functions. Or maybe, you could pass some kind of "scope" interface that provides functi
by tadfisher 4y ago
The opposite would be better: an "impure" keyword for specifying impure functions.
Or maybe, you could pass some kind of "scope" interface that provides functions for executing side effects. So "impure(IO) function printStuff()" brings all the functions in IO into scope for the body of printStuff.
- castrodd 4y agoWhy would the opposite be better? Aren't most functions impure? The original proposal made sense to me, but I am curious as to why you believe impure is better. Can you elaborate?
- andreareina 4y agoPure being the default would lead to most functions being written to be pure. Same idea as immutability by default.
- goto11 4y ago> Pure being the default would lead to most functions being written to be pure. More likely it would lead to most functions looking like they are pure, whether they are actually pure or not. For example, any function written before the "impure" modifier was introduced would look pure.
- deleted 4y ago[deleted]