2 ms·
Duals 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 ob
by jfoutz 10y ago
Duals 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.