3 ms·
common errors in other languages -- your segfaults and NPEs and buffer overflows I never see those in Smalltalk. I'd be surprised if that's an issue in Python
by stcredzero 16y ago
common errors in other languages -- your segfaults and NPEs and buffer overflows
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.)
- rtperson 16y ago> 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.
- chc 16y agoRuby'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.)
- stcredzero 16y agoDo you have unit tests with good code coverage?
- anamax 16y ago> 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 ....
- kscaldef 16y agoNilClass DoesNotUnderstand ... is morally equivalent to an NPE in my book.
- chc 16y agoBut 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.