3 ms·
I do find pureness a great feature. While I agree that many things are not unique to FP, or can be easily incorporated into multiparadigm languages, I think hav
by kaba0 5y ago
I do find pureness a great feature. While I agree that many things are not unique to FP, or can be easily incorporated into multiparadigm languages, I think having a compiler-enforced “pure” keyword for example would benefit traditional OOP/imperative languages as well. E.g. C would not have to do ugly compiler hacks making common functions like strlen a macro so that the compiler can hoist it out from a for loops conditional for example. Currently they can only assume it through hacks or through inlining.
Of course “pure” functions will have memory/CPU overhead, but that is inevitable. Perhaps you would prefer idempotent and memoizable?