Re:"In Haskell we think for quite a long time before startin...
by chc on Monday December 27, 2010 @01:11PM
(#2043120)
But the thing is, null/nil/incorrect type references (the cause of NPEs and doesNotUnderstand:s) aren't a problem in Haskell. If you try to pass the wrong type, you'll know right away, before you even get to your hand-written tests — and values that might be Nothing (the Haskell nil) are a different type than normal values. A plain-jane String that is always a list of characters is a different type than a Maybe String and the compiler will catch the mistake for you if you forget that.
Re:"In Haskell we think for quite a long time before startin...
by kscaldef on Monday December 27, 2010 @12:48PM
(#2043047)
NilClass DoesNotUnderstand ... is morally equivalent to an NPE in my book.
Re:"In Haskell we think for quite a long time before startin...
by rtperson on Monday December 27, 2010 @11:39AM
(#2042860)
> I'd be surprised if that's an issue in Python, Ruby, or Lisp.
I'd be very surprised if there weren't similar issues in these languages, since these are all duck-typed and the topic at hand is "bugs prevented by rigorous up-front type checking." I don't have extensive experience in any of the above, so I couldn't include any examples of errors they are prone to.
Re:"In Haskell we think for quite a long time before startin...
by chc on Monday December 27, 2010 @01:16PM
(#2043140)
Ruby's method_missing, the equivalent of Smalltalk's doesNotUnderstand:, is a plague on Ruby programmers. It might mean something returned nil, it might mean the wrong type got passed or returned, it might just mean that you forgot to include a module — but you will run into them more times than you can count while you're developing a Ruby app. (Or at least I will. I don't know. Maybe everybody else has better luck with their libraries or is just more studious than I am.)
Re:"In Haskell we think for quite a long time before startin...
by stcredzero on Tuesday December 28, 2010 @11:23AM
(#2045831)
Do you have unit tests with good code coverage?
Re:"In Haskell we think for quite a long time before startin...
by anamax on Monday December 27, 2010 @11:49PM
(#2044668)
> I'd be very surprised if there weren't similar issues in these languages, since these are all duck-typed and the topic at hand is "bugs prevented by rigorous up-front type checking."
Duck typing means that I can run an incomplete program, that is, one that will misbehave for certain inputs.
It turns out that running incomplete programs is incredibly useful.
Yes, I can spend time up front to fake a complete program and remove the fakeness as I provide additional completeness, but ....
I never see those in Smalltalk. I'd be surprised if that's an issue in Python, Ruby, or Lisp.
(But the number of DoesNotUnderstand errors in Smalltalk is quite impressive. This is why XUnit unit testing was first developed in Smalltalk. Unit testing with good code coverage is the only way to reliably prevent those.)