4 ms·
I'm curious what you have in mind that doesn't boil down to "duck typing?"
by taeric 2y ago
I'm curious what you have in mind that doesn't boil down to "duck typing?"
- wwweston 2y agoNot the most elegant mechanism, but it should be accessible to imagine an implementation via inheritance hierarchies even for a static manifestly typed language. Class "Person4.1" inherits from class "Person4" inherits from class "Person2" inherits from "Person". Probably there's a better way (and one could argue that a design where knowing the version of the class/object matters isn't a well-encapsulated design, which could have something to do with why duck typing often works out better than expected in OO systems).
- taeric 2y agoI think my question is what would you be doing here that doesn't boil down to "has these properties/methods, I'll accept"? I think this is a lot easier if you exclude the "methods" in my quote there. Since those almost certainly have the same general contract that would spread across things.