Hacker News new | ask | show | jobs
by cardanome 1307 days ago
Yes, I am aware of that.

The point is, Polymorphism in dynamic languages is pretty trivial.

There is a reason the golang devs resisted introducing generics for so long, it introduces complexity and can be hard to debug.

If you read my side-note:

> The problem is that types in dynamic languages can easily get super complex without feeling complex while for static languages you might need very advanced features (dependent types and other scary stuff) to represent some cases

If you want to have a functional example: Elm and it's lack of type classes or similar features. There is a reason Elm is resisting to implement a better way to add ad hoc polymorphism for better or worse. It is difficult to fit into the goal of Elm being a simple and easy to use language.

So yes, you can either have a more complex static type system and pay the price for that or just bite the bullet and over specify types.(The problem is also one of ergonomics. Programmer might over specify types because that is the path of least resistance or because things like generics make code harder to debug.)