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

For this type of discussion I think it's important to contrast statically (or manifest) and dynamically typed languages. Lumping together inheritance and polymorphism kind of just happens with the former. With dynamically typed languages you have more freedom to just throw the right functions into your object and informally declare that your object will work with calling function, regardless of the specific type.

Of course now you have to talk about semantic polymorphism, e.g. will the outcome of calling some polymorphic functions have the right effect on the system? This is where static type systems have it easier because you typically tie stuff together in related hierarchies.

The Go structure embedding thing was a surprise to me, having grown up with C and C++ it looks unexpected. Not sure I like it but I think I do.



You're describing nominal and structural typing. This concept is orthogonal to static and dynamic type checking.

Go and TypeScript are examples of languages with statically checked structural type systems. While C# has statically checked nominal type system.

I don't use dynamic languages much, so maybe someone else could chime in with a few examples.




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

Search: