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

> ... all objects that understand a given protocol (set of methods) and implement it in a sensible way are substitutable with each other (with respect to the protocol) irrespective of their place on the inheritance hierarchy (or even whether such protocol was formally defined)....

This is a very interesting property, and you'll also see it in statically-typed languages which support row polymorphism, like OCaml. OCaml directly supports OOP and subclassing, but it also supports structural typing, which means that objects are type-compatible if they support the same methods.

Unlike Smalltalk, this is all resolved at compile time, so it's quite efficient.




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

Search: