I think the real issue here is just that assertions sometimes aren't used correctly.
Assertions and exceptions are fundamentally different concepts. Assertions should be used for statements that literally should always be true. And I mean that almost mathematically, as in most assertions should be able to be logically proven. This is why they can be turned off on production servers, because they simply won't happen.
Exceptions are just what the name says: exceptions. While they shouldn't happen often, exceptions do happen, and thus need to be caught and handled.
Also, assertions in PHP do not have any performance overhead once they're turned off for production servers, so that won't be an issue either.
*-- * *Tyler Romeo* Stevens Institute of Technology, Class of 2016 Major in Computer Science www.whizkidztech.com | tylerromeo@gmail.com
On Tue, Jul 30, 2013 at 6:28 PM, Tim Starling tstarling@wikimedia.orgwrote:
On 31/07/13 07:28, Max Semenik wrote:
I remeber we discussed using asserts and decided they're a bad idea for WMF-deployed code - yet I see
Warning: assert() [<a href='function.assert'>function.assert</a>]: Assertion failed in
/usr/local/apache/common-local/php-1.22wmf12/extensions/WikibaseDataModel/DataModel/Claim/Claims.php
on line 291
The original discussion is here:
< http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/59620
Judge for yourself.
-- Tim Starling
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l