3 ms·
If we want to get really picky, they are procedures. I think we should start to transition to using the word function only in the connotation provided in funct
by moron4hire 11y ago
If we want to get really picky, they are procedures.
I think we should start to transition to using the word function only in the connotation provided in functional programming languages, where functions are first class citizens and can be treated as values. Also, should probably prefer to imply a lack of side effects from the word function.
Method is clearly a certain function or procedure that is scoped to a class. So that leaves procedure as a name left over for the type of bare function that isn't a value, that is a statement rather than an expression.
I think subroutine and subprogram are just archaic sounding, and don't really imply anything that the others don't. Method, functions, procedures, I think that's all we need.
- Tyr42 11y agoSo, the distinction that I've learnt is that functions return values and procedures are run for their side effects. So, strlen, for example, is a function, and printf is a procedure. (Yes I know prints returns an int, but it's run for it's side effects primarily.)