[Issue 20784] New: Assert expression specification needs to be updated

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 29 01:46:28 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20784

          Issue ID: 20784
           Summary: Assert expression specification needs to be updated
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

https://dlang.org/spec/expression.html#assert_expressions

> The first AssignExpression must evaluate to true. If it does not, an Assert Failure has occurred and the program enters an Invalid State.
> Undefined Behavior: Once in an Invalid State the behavior of the continuing execution of the program is undefined.

This in theory is true. And https://github.com/dlang/dmd/pull/6896, if merged,
would actually make it really true. (It would be great if we got some progress
on that PR). However see my next comment:

> Do not attempt to resume normal execution after an Assert Failure.

But then what is the point of `Runtime.extendedModuleUnitTester`? If an
application enters an Invalid state then after the very first assertion failure
it wouldn't make sense to continue running tests in other modules. But Druntime
explicitly supports this feature..

> AssertExpression has different semantics if it is in a unittest or in contract.

The documentation doesn't actually list what the differences are. But maybe it
should just link to the contracts page?

--


More information about the Digitalmars-d-bugs mailing list