ZILtoid1991@lemmy.world to Programmer Humor@programming.devEnglish · 9 months agoFunctional bros be likelemmy.worldimagemessage-square59fedilinkarrow-up1303arrow-down116
arrow-up1287arrow-down1imageFunctional bros be likelemmy.worldZILtoid1991@lemmy.world to Programmer Humor@programming.devEnglish · 9 months agomessage-square59fedilink
minus-squarejkrtnlinkfedilinkarrow-up9·9 months agoI think using both is normal. Closures and objects are duals of each other. Do whatever is understandable and maintainable, neither paradigm is magic.
minus-squarelemmesay@discuss.tchncs.delinkfedilinkarrow-up4·9 months agothat’s a nice way to look at it. thanks!
minus-squareKogasa@programming.devlinkfedilinkarrow-up1arrow-down2·9 months agoIs the duality statement meant to be true in a technical sense?
minus-squarejkrtnlinkfedilinkarrow-up1·9 months agoYeah! For example, if the language allows closures to capture state, they can act like properties on an instance.
minus-squarejendrik@discuss.tchncs.delinkfedilinkarrow-up1·9 months agoA closure is a function with captured state. An object is state with methods.
I think using both is normal. Closures and objects are duals of each other. Do whatever is understandable and maintainable, neither paradigm is magic.
that’s a nice way to look at it. thanks!
Is the duality statement meant to be true in a technical sense?
Yeah! For example, if the language allows closures to capture state, they can act like properties on an instance.
I don’t see the duality
A closure is a function with captured state. An object is state with methods.