assert semantic change proposal
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 9 18:46:08 PDT 2014
On Sat, Aug 09, 2014 at 05:54:21PM -0700, Walter Bright via Digitalmars-d wrote:
> On 8/7/2014 10:44 AM, Daniel Murphy wrote:
> >I meant asserts in pre-conditions when used with inheritance. It's a
> >pass if any of the preconditions pass, so the compiler runs them in
> >turn and catches all but the last.
>
> That's right, they are OR'd together.
Which is fine if they are evaluated as a single expression. The problem
right now is that the OR is simulated by catching AssertErrors, which by
definition only happens when the program in an invalid state, so the
fact that this works at all is only a "lucky coincidence". :-( If
you're "not so lucky" you end up catching a genuine program bug but
ignoring it because the other condition in the simulated OR turned out
to pass. This unfortunately puts DbC in D on rather shaky ground.
T
--
Кто везде - тот нигде.
More information about the Digitalmars-d
mailing list