Structural typing, or did OO get interfaces wrong?

Lapsang logoLately I have been doing a lot of thinking about programming languages and how ideas change over time on what constitutes good language functionality. As I enjoy playing around with grammars and parsers, I naturally started thinking about the idea of designing a hypothetical language of my own and what form it would take. One area that I was keen to address is OO’s interfaces and inheritance. It’s a topic I’ve had many heated debates with various people over the past couple of years and so it seemed a natural place for me to start. As I was trying to work out how best to express my ideas, Microsoft launched TypeScript. It implements what I feel interfaces should have been all along and even gave me an “official” name for the technique: structural types. Continue reading “Structural typing, or did OO get interfaces wrong?”