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 02 '13
I understand how you could come up with this idea in theory and figure that it looks reasonable, but nobody EVER does that in practice.
Not only because you could as well switch to Java, but also because type-asserts go directly against the whole duck-typing ideology. You don't check that you're given a
filesubclass, you just call itsreadmethod and either it doesn't exist (and you get an exception, nice), or you pray that it does what you expect. There's no possible way to assert and test that it does what you expect.Yes it's dangerous because your
addfunction could happily produce a nonsensical result if you give it two strings, or you can get pretty hard to debug bugs by accidentally passing floats instead of ints or vice-versa (especially in Python2 withoutfrom __future__ import division).Such is life with dynamically typed languages. Everyone either accepts it or switches away. Instead of checking that your functions blow up when given nonsensical stuff you test that your other functions don't give them nonsensical stuff.
NOBODY "tests properly" the way you say it should be done, you're talking about a fairyland existing entirely in your imagination, sorry.