3 ms·
"Doctor, it hurts when I do this" "Don't do that then" This kind of problem with using heavily inheritance-based systems for behavior can be addressed by usin
by pjc50 7y ago
"Doctor, it hurts when I do this"
"Don't do that then"
This kind of problem with using heavily inheritance-based systems for behavior can be addressed by using entity component systems. Often found in game development. The general guidance these days is to use "is-a" relationships less and "has-a" relationships more.
- cryptica 7y agoYes but my point is that if you allow an instance of a specific class to either have or not have a specific method/behavior at runtime, then you lose type safety which is the whole point of a dynamically typed language. The point that I'm trying to make is that true compile-time type safety is not possible in my example without some kind of rigid complex inheritance structure that is predefined at compile time.