@[email protected] to Programmer [email protected]English • 3 months agoFunctional bros be likelemmy.worldimagemessage-square61fedilinkarrow-up1310arrow-down117
arrow-up1293arrow-down1imageFunctional bros be likelemmy.world@[email protected] to Programmer [email protected]English • 3 months agomessage-square61fedilink
minus-square@[email protected]linkfedilink9•3 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-squareKogasalinkfedilink-1•3 months agoIs the duality statement meant to be true in a technical sense?
minus-square@[email protected]linkfedilink1•3 months agoYeah! For example, if the language allows closures to capture state, they can act like properties on an instance.
minus-square@[email protected]linkfedilink1•3 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.