On 31/07/13 08:45, Tyler Romeo wrote:
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.
Interesting concept. I think in C, they are most often used for
validating function input, so obviously they can be hit. The Wikipedia
articles [[Assertion (software development)]] and [[Precondition]]
both mention this usage.
In the Wikidata code in question, assertions are used for both
preconditions and postconditions of non-private functions.
-- Tim Starling