Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> composition addresses any concern you might have.

Agreed about this, of course. My approach is based on trying to describe what exactly it is that implementation inheritance adds beyond pure composition, and "open recursion", meaning late-bound dispatching through the 'this' or 'self' implied parameter (which is what potentially allows method calls anywhere in the hierarchy to dispatch to overridden methods in derived classes) is the pithy answer to that question.

The generic typestate pattern turns out to be a close analog in that it also involves function calls that go through a genericized "Self" object.

I do think that this leads to quite severe problems wrt. getting caller and callee code to agree on expected semantics in a large, multi-modular and potentially a quickly evolving codebase (which is what "programming in the large" means as a term of art) but then I've made that point above already and I'm not going to belabor it.



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: