[RFC] Throwing an exception with null pointers
user1234
user1234 at 12.de
Thu Apr 17 11:03:37 UTC 2025
On Thursday, 17 April 2025 at 05:31:48 UTC, Walter Bright wrote:
> [...]
> I don't see how a runtime detector can work better than a seg
> fault with stack trace.
Actually I have implemented a runtime detector in another
language and that gives me
-- quite rarely -- things like
> temp.sx:11:7: runtime error, member read with null `this`
So that you know directly where the problem is and often there's
even no need for running again in gdb. That is implemented in the
Dlang equivalent of the DotVarExp. Concretly it's about
codegening the same as for an assertion and just right before
loading from the LHS.
That's why, previously in the thread, I called that an "implicit
contract". Aren't assertions the most primitive form of contracts
?
More information about the Digitalmars-d
mailing list