
On 30 March 2010 10:04, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
Which isn't necessarily the best way to do it, and certainly isn't the only one. There is effectively zero runtime cost for XInt's exception-blocking mechanism, since the code used for it is only evaluated when an exception needs to be thrown.
There is, however, conceptual and infrastructure overhead from supporting it. First, there's the fact I've previously mentioned than NaN weakens the invariant of the xint type. This requires extra effort in specifying functions that take and return xints. The most obvious evidence of this is the fact that almost every function in the library has the following line in its documentation: "Can throw: xint::not_a_number if n is Not-a-Number." Second, the blocking is stateful. That means that if I write another library that accepts xints, I'll have to either write every function to work no matter the blocking mode or change it to what I want to work with. This state maintenance means bringing in the threading complications that are otherwise unnecessary.