Andrew Lentvorski wrote:
At this point, I have been using both long enough that I am pretty convinced that exceptions are interchangeable with return codes.

You've used only some pretty lame languages, then.

Anything with preconditions and postconditions (i.e., "design by contract") needs a different concept for exceptions in a way that return codes specifically can't be used to replace.

Anything with typestate (e.g., you can't use an uninitialized variable) needs exceptions again in a way that return codes specifically can't be used to replace.

Basically, anything where the design of the language is such that different exceptions have to go to different parts of the code (or, equivalently, an exception has to go someplace different from a non-exception), you have a requirement that can't be met by return codes.

--
  Darren New / San Diego, CA, USA (PST)
    His kernel fu is strong.
    He studied at the Shao Linux Temple.

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to