3 ms·
The thing that's really undesirable about the clojure code is an unfortunate consequence of dynamic typing. Note that the bottom right corner of the expression
by yummyfajitas 10y ago
The thing that's really undesirable about the clojure code is an unfortunate consequence of dynamic typing.
Note that the bottom right corner of the expression problem matrix isn't filled in. This means that newOp(newType) will fail at run time - you've simply replaced the difficult task of filling in the matrix with the easier task of partially filling it in and hoping for the best. Hope you've got a great test suite!
I must say that I strongly prefer the Haskell/Scala/etc approach where that missing square is an explicit compile time warning/error.
- dmichulke 10y agoIn my experience, if you write tests to see whether the function returns what it should (or just an integration test for a few use cases), you got types covered. YMMV
- pjmlp 10y agoYou can make use of clojure.typed or schema. Yes, they aren't the same as static typing, but they help nonetheless.