3 ms·
> This is impossible in oo languages It's possible in languages which support extensions, such as Swift, Dart or Kotlin.
by RivieraKid 6y ago
> This is impossible in oo languages
It's possible in languages which support extensions, such as Swift, Dart or Kotlin.
- dnautics 6y agono it's not, because a key part of OO is encapsulation. You really do need a functional language with naked, fully introspectable types everywhere, for this to work effectively.
- deleted 6y ago[deleted]
- RivieraKid 6y agoI tried it in Dart and it worked, so it's possible. But maybe I don't understand your point, if so, tell me what exactly would be impossible to implement in a language like Swift, Dart, Kotlin.
- dnautics 6y agoyes, you can add an inspect method to every object, but you'll also have to add an inspect method to every object. That's the problem.