[math] assert policy

2012-08-15 Thread matic
Sebb, Gilles and I would like to start a discussion about the use of assert in CM code. This started by comments in a JIRA ticket (https://issues.apache.org/jira/browse/MATH-845), I rewrite below a summary: Gilles, commenting on my code: assert statements should be replaced by precondition

Re: [math] assert policy

2012-08-15 Thread Gilles Sadowski
On Wed, Aug 15, 2012 at 10:46:06PM +0200, matic wrote: Sebb, Gilles and I would like to start a discussion [...] It was not that Sebb who commented on MATH-845... ;-) [...] @Gilles: sometimes assertion are a form of comments on steroid - they will bark at you if you did not read

Re: [math] assert policy

2012-08-15 Thread James Ring
Just a quick observation: at Google the Java practices guide says assert == //. Assertions can be disabled, so you should never rely on it to crash if something is seriously wrong and you should never rely on side-effects of the assert expression. On Wed, Aug 15, 2012 at 4:02 PM, Gilles Sadowski

Re: [math] assert policy

2012-08-15 Thread Ted Dunning
Asserts can be handy to inject additional checking into execution inside private areas of a class during unit tests but it should be assumed that they are disabled any other time (and the unit test should do real assertion checking redundantly) On Wed, Aug 15, 2012 at 9:33 PM, James Ring