Re: [Wikidata-tech] Is assert() allowed?

2013-07-31 Thread Tim Starling
On 31/07/13 18:36, Daniel Kinzler wrote: Assertions are things that should *always* be true. In my mind, assertions should just throw an (usually unhandled) exception, like Java's AssertionError. Indeed. In C, assert() will abort the program if it is enabled, which is hard to miss. It is not

Re: [Wikidata-tech] Is assert() allowed?

2013-07-31 Thread Daniel Kinzler
Am 31.07.2013 13:42, schrieb Tim Starling: We could have a library of PHPUnit-style assertion functions which throw exceptions and don't act like eval(), I would be fine with that. Maybe MWAssert::greaterThan( $foo, $bar ) or something. I like that! Should support an error message as an