Timeline for What's the difference between a function and a method?
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 18, 2020 at 3:41 | history | edited | Karl Bielefeldt | CC BY-SA 4.0 | remove irrelevant and inaccurate sidebar on FP and state |
| Apr 29, 2016 at 9:29 | comment | added | Vatine | I woould actually use different terminology. What you call "function", I would call "pure function". Anything that may have side-effects but still returns a value, I would call "function" and anything with only side effects is, as you state, a "procedure". | |
| Oct 19, 2015 at 5:08 | comment | added | Integer Poet | I'm pretty sure "the very pedantic" should be my honorific. | |
| Dec 27, 2013 at 15:37 | comment | added | 9000 | While the distinction between [pure] functions and [effectful] procedures is important, I don't see what does it have to do with the distinction of either from methods. You can easily have standalone procedures that return void and produce side effects; stdlib.h declares a few. You can have immutable objects with all methods being pure, see java.lang.String for an example. It's passing of an object instance in a special way that makes a method; semantically things like stream.write(data) and write(stream, data) may be equivalent. | |
| Dec 27, 2013 at 13:26 | comment | added | Karl Bielefeldt | Getter methods aren't usually functions in the pure sense, because they potentially return a different value different times you call them. Getters of immutable objects are functions though. | |
| Dec 27, 2013 at 12:36 | comment | added | Tulains Córdova | Getter methods returns a value. Aren't they functions ? | |
| Dec 26, 2013 at 17:41 | comment | added | JensG | ... and Pascal/Delphi. Noteworthy detail that Prism/Oxygene uses method. BTW, the OPs question was about function/method, not procedure/function. ;-) | |
| Dec 26, 2013 at 16:54 | comment | added | James | The only language I've used that made a distinction between procedures and functions is VB | |
| Dec 26, 2013 at 16:19 | history | answered | Karl Bielefeldt | CC BY-SA 3.0 |