Hi Tim,
On Mon, Mar 19, 2012 at 11:20:53PM +1100, Tim Starling wrote:
assert_options( ASSERT_ACTIVE, 0 );
[ unmotivated ranting ]
I was talking about performance on production servers. Obviously. Where else would performance matter?
And yes. On production servers, one typically turns checking assertions off.
assert's are used to catch situations that catch logic errors. You want to do that during /development/. They are a tool for development and documentation.
Asserts are not just another nice way to burn cycles on production systems :D
I doubt that the PHP and MySQL binaries used in production were built with assertion checking enabled, were left unstripped, ...
My previous test of assert() involved a case where the assert() and the if() were doing roughly the same thing.
'assert' and 'if' are not designed to do the same thing ... So why should we care to cripple one to simulate the other?
I'd much rather compare how the available tools get required job done. And for conditions that /always/ hold, assert would be the right tool.
assert() is better than nothing. It's not better than exceptions and unit tests, especially not in PHP.
PHP's assert and unit tests have nothing to do with each other. They are orthogonal tools.
Either way MediaWiki's stance on the issue is clear now: To MediaWiki, PHP's assert is evil.
Fair enough!
Kind regards, Christian