News for hackers. Stuff that matters.
Re:Isaacs: try/catch is an anti-pattern by perfunctory on Monday November 14, 2011 @06:28AM (#3233637)
The core of the post:

  try/catch, which blurs the line between errors
  that are *mistakes* (accessing a property of null,
  calling .write() on a stream after .end(), etc.), 
  and those which are expected application-level problems
  (invalid data, file missing, and so on).
Totally agree.
Re:Isaacs: try/catch is an anti-pattern by morsch on Monday November 14, 2011 @07:54AM (#3233776)
In a typed exception system, you just assign different kinds of exceptions to all of those. Java also distinguishes between checked exceptions ("known unknowns") which need to be declared, and runtime exceptions ("unknown unknowns"). Sure, you can still catch all of them in one place, but that's very rarely a good idea.

A non-typed exception system (that doesn't solve the problem with another mechanism) just sounds like a very bad idea. Is Javascript like that?

Re:Isaacs: try/catch is an anti-pattern by thomasz on Monday November 14, 2011 @07:58AM (#3233785)
It totally depends on your Application. I wouldn't call a non existing file referenced by a db record, an strange log entry or a malformed xml returned by a webservice an "expected application-level problem". There is absolutely no way for a library writer to decide between an expected and an exceptional condition.