Hacker News new | past | comments | ask | show | jobs | submit login

The problem balancing implementation vs ontological inheritance while providing strong type safety is that your language needs to either support defining contravariant types (and you still likely end in a mess, see Scala's eternal discussion about "total" type safety), or you disallow ontological inheritance completely (like Golang, and therefore cannot support many modern programming features, for the better or worse, doesn't matter). Not sure if there is a language that truly does the opposite by design, though (being strongly typed and disallowing implementation inheritance, while providing ontological inheritance). Such a language might be the DDD modeller's heaven? :-)



> or you disallow ontological inheritance completely (like Golang, and therefore cannot support many modern programming features

Sincerely, what features does this preclude. I pretty much ignore ontological inheritance in any programming language because it never seems useful. Am I missing something?


Same here. The whole "is a square a type of rectangle, or is a rectangle a type of square" question seems like an unnecessary debate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: