Re: [sage-devel] Re: Future NTL versions and exception handling

2014-11-14 Thread Victor Shoup
Yes, that is an issue. Writing exception-safe code is hard, as I'm finding out... Of course, I'll have to provide a way to turn off/on exceptions, both at compile time and at run time. On Thursday, November 13, 2014 12:04:53 PM UTC-5, Robert Bradshaw wrote: Sage's wrapping of NTL should be

Re: [sage-devel] Re: Future NTL versions and exception handling

2014-11-13 Thread Robert Bradshaw
Sage's wrapping of NTL should be just fine as long as it's declared in the Cython declarations, but there's a question of all the libraries that use NTL indirectly which may have more difficulty adapting to exceptions being thrown though their call stacks. On Tue, Nov 11, 2014 at 3:48 PM,

[sage-devel] Re: Future NTL versions and exception handling

2014-11-11 Thread Volker Braun
What kind of error states are we talking about? divide by zero and out of memory? IMHO a C++ library should just throw C++ exceptions, thats what they are here for. If only for better readability - less bugs. If you declare methods with except + to Cython then they will automatically be

[sage-devel] Re: Future NTL versions and exception handling

2014-11-11 Thread Jean-Pierre Flori
On Tuesday, November 11, 2014 11:55:49 PM UTC+1, Volker Braun wrote: What kind of error states are we talking about? divide by zero and out of memory? Exactly, that is exactly the kind of stuff Victor mentioned. IMHO a C++ library should just throw C++ exceptions, thats what they are

Re: [sage-devel] Re: Future NTL versions and exception handling

2014-11-11 Thread Francesco Biscani
OOM exception handling is gonna be hard to implement, as GMP does not provide any mechanism to recover from memory errors. You can replace the GMP memory management functions but the usual problem with that approach is that you might be potentially interacting with other packages which might also

Re: [sage-devel] Re: Future NTL versions and exception handling

2014-11-11 Thread Jean-Pierre Flori
On Wednesday, November 12, 2014 12:48:16 AM UTC+1, bluescarni wrote: OOM exception handling is gonna be hard to implement, as GMP does not provide any mechanism to recover from memory errors. You can replace the GMP memory management functions but the usual problem with that approach is