4 ms·
The more common distinction between functions that return values and procedures that do not return values is not important at all. On the other hand the distin
by adrian_b 5y ago
The more common distinction between functions that return values and procedures that do not return values is not important at all.
On the other hand the distinction between "pure functions" and other kinds of functions or procedures is quite important.
In many early programming languages, the "functions" had to be what now are called "pure functions".
Later many languages relaxed the restrictions for "functions" allowing them to have side effects, but then the more important distinction was lost.
Only relatively recently many languages began to provide again means to specify that a function is a pure function.
- scns 5y agoAs a pedant myself, i find this rather pedantic. Language use evolves and insisting it is only correct when words are used with their original meaning won't win you much. If you distinguish between produres and functions or functions and effects, many will get what you mean and it is more elegant IMSubjectiveO. Same goes for im/mutability, i think val/var is more elegant than let/let mut but that is only my opinion on aesthetics. I like good design but still think function is more important than form.
- adrian_b 5y agoThe "pure" functions have different properties with respect to program optimization and program verification, in comparison with the functions or procedures with side effects. That is the reason why this distinction matters. The distinction between mutable and immutable variables matters for the same reason. Otherwise, the difference between a "procedure" and a "function" with side effects where you ignore the return value has no practical consequences. There are contexts where you do not care about the optimizations that can be done by the compiler or about program verification, but there are also contexts where you care.