3 ms·
Doesn’t stop you from passing in wrong arguments, your function requires an int and you give it a string because you typed the wrong variable name there, or you
by hellofunk 8y ago
Doesn’t stop you from passing in wrong arguments, your function requires an int and you give it a string because you typed the wrong variable name there, or you mistype a keyword, which is never caught by the compiler, and you end up with nil floating through your app.
- mvid 8y agoCan’t you just use type hints (in both clojure or python 3)?
- hellofunk 8y agoThey don't take care of this issue most of the time, and in Clojurescript they are meaningless. In Clojure, only hints on primitive Java types (integer, etc) do something meaningful, so any custom Clojure types or your own "types" have no such checking, and in particular keywords are always valid if they are mistyped which results in a running program with no errors that creates nil and null pointer exceptions and undefined and other things all over the place. It's a tradeoff for using an expressive dynamic language, I guess.
- nickserv 8y agoType hints are not taken into account by the Python interpreter. They do help an IDE like pycharm, but that won't catch all errors.