On Friday, 1 August 2014 at 14:08:56 UTC, Daniel Gibson wrote:
.. but even if I were: words used for constructs/function-names/... in programming often don't 100% match their "real" meaning (as used in human communication)[1] - why should it be different for assert(), especially when not implemented/used like that in many popular programming languages?

The way Walter is suggesting assert be handled is much more in line with the real English meaning (plus all of the resources posted seem to back up his position much more strongly than the other way), so that's why I'm siding with Walter on this (mostly). Imagine my surprise when I Google'd "assert definition" to find it meant "state a fact or belief confidently and forcefully."... the definition of the word really makes it obvious what the feature was originally intended to convey. Upon reflection, the definition that everyone is suggesting for assert ("something that is proven by being checked") really doesn't make a whole lot of sense given the facts laid out about assert.

Asserts are just facts that you state about the program. It's just a "nice feature" that the compiler will check your asserted facts when you're debugging your code. If you aren't stating a fact about the state/behavior of the code, you probably shouldn't be using an assert there (I feel that I've misused asserts from the beginning by not knowing this, though).

Reply via email to