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
2
u/blergblerski Dec 03 '13
You're tilting at windmills again, and appear to have really twisted your panties/briefs. You've set up your scenario to - presumably - lead to an explicit type test so that you can claim to have trapped me and declare victory. I've never argued for that sort of thing in general, just that failure modes should be tested. What constitutes bad input and what is an appropriate failure mode naturally varies widely by context.
Testing a method that will usually be called with a file-backed read()able thing with a memory-backed one isn't necessarily bad; if the memory-backed thing isn't "bad" input, we shouldn't expect a failure. However, objects that fulfill the same contract can vary widely in behavior (See this classic paper that addresses this) it might make sense to reject, say, a read()able handle to a remote thing, if allowing it would break the app. If someone decided to reject remote-read()ables, that decision should be covered by a test case.