News for hackers. Stuff that matters.
Re:Even pure functions have side-effects by tungstentim on Tuesday September 06, 2011 @09:07PM (#2967931)
Synchronous exceptions are debatable. For example, a library function throwing an exception may require its callers to use "finally" clauses (or similar constructs in other languages) in order to maintain Exception Safety.

Also, a common property of "pure" functions is that it doesn't matter what order you call them in. But if you reorder calls to functions which can throw exceptions, you may get different results.

Asynchronous exceptions on the other hand are usually fine. For example, square-root library library functions aren't defined in terms of how much stack space is available on the machine; they're defined in terms of their argument.

Systems which have asynchronous exceptions ideally permit programs to handle them with code at carefully chosen places, rather than code spread around everywhere.

There are no comments on this comment yet.