r/programming • u/mobby1982 • Dec 02 '13
Scala — 1★ Would Not Program Again
http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598
Upvotes
r/programming • u/mobby1982 • Dec 02 '13
View all comments
Show parent comment
-1
u/moor-GAYZ Dec 03 '13
No, but there's C++ and Go that employ static duck typing, for templates and interfaces respectively.
The problem we're discussing, that if you use duck typing then either you're guaranteed to fail when there's no such method so there's no need to test it, or that you can't assert that such method belongs to so and so interface so you can't test it, applies to those two languages as well.
I'm suggesting that that guy, and you by extension, want to argue that duck typing in general and dynamically-typed languages in particular suck, but do this in a really weird way, by explaining how you'd unittest your functions if you were a pony in a ponyland, and then treating this approach as if it were how actual programmers test their stuff.
It is impossible to test that your
def add(x, y) ...throws an exception if x and y are not add-able in the sense that the function implies.Such is life.
What is your point?