this post was submitted on 21 Mar 2024
297 points (95.1% liked)
Programmer Humor
19572 readers
1276 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.