3 ms·
I think in effect you're saying that they're duals. I think I would argue that objects bundle data and functions in a useful way (when done right). Closures ar
by Tloewald 9y ago
I think in effect you're saying that they're duals.
I think I would argue that objects bundle data and functions in a useful way (when done right). Closures are more of an expressive convenience for constructing functions on-the-fly. The overreach for objects is to consider them as the only way to organize data and functions.
- jfoutz 9y agoDuals has the right flavor, but my opinion is just an opinion, i won't try to defend that with any kind of formalism duals would imply. I agree with you wrt objects bundle data and functions, but for my code, that sometimes causes cracks, disagreements about how i mentally model the code vs how i have to write it out. For example the visitor pattern is this little syntactic boilerplate dance to get a specific kind of behavior collected in one file. The closure way, you can build a special dispatch, and put all the implementations there. I don't think there's a right answer. I just go along with what i think people will understand. There's a lot of value in having a standard and well understood dispatch system we all understand, even if it gets sort of odd in some cases. With the closures, dispatching can be as crazy as you want. Create cycles of A extends B, B extends C, and C extends A for example.
- ionforce 9y agoWhat is a dual?
- recursive 9y agoIt's a table in all Oracle databases that has nothing in it. Also, it's this: https://en.wikipedia.org/wiki/Duality_(mathematics) https://en.wikipedia.org/wiki/Duality_(mathematics)
- deleted 9y ago[deleted]
- bartl 9y agoPeople who have studied electrical engineering may recognize the word "dual" with the prototypical example in electrical networks: Norton vs. Thevenin. Both are equivalent but from coming from opposite ends. A current source in parallel with a resistor (Norton) is electrically equivalent to a voltage source in series with a resistor (Thevenin). (See, for example: https://www.allaboutcircuits.com/textbook/direct-current/chpt-10/thevenin-norton-equivalencies/ https://www.allaboutcircuits.com/textbook/direct-current/chp...)