Hacker News new | ask | show | jobs
by wirrbel 4333 days ago
That clojure does not follow the duck typing approach of ruby and python but uses interces (protocols) does not make it a statically typed language. It is still dynamically typed to my understanding as the implementation of a protocol "method" is chosen at run time, i.e. _late_ binding.

For example: If I implement the ISeq data structure, I can use instances of my ISeq implementation in code that was written for lets say list processing (such as a function that uses ``(first val)``. The implementation is looked up at runtime. My program compiles, even if I call ``(first 4)``, it will lead in an error at runtime however, since the number 4 is not a sequence. Java is fundamentally different. It is checked at compile time whether the ``val`` does adhere to the interface. This is what makes it static.