On Friday, 17 November 2017 at 09:44:01 UTC, rumbu wrote:

I know your aversion towards C#, but this not about C#, it's about safety. And safety is one of the D taglines.

Well the nice thing about that discussion (at: https://blogs.msdn.microsoft.com/dotnet/2017/11/15/nullable-reference-types-in-csharp/ ), was that not everyone agreed. So maybe there is hope for C# yet.

Indeed many C# users seemed to 'strongly' disagree, and good points were made for 'not' making the change.

Sounds to me, like too many people are writing incorrect code in the first place, and want to offload responsibility onto something other than themself. This is why we have bloated runtime checks these days.

I've always thought writing the correct code was the better option anyway.
Maybe even (god forbid)..  test it.

As for safety in D....it's already there.
.....

module test;

import std.stdio;

static immutable Exception TheYouIdiot_Exception = new Exception("You idiot!");

class Test
{
    int Value;
}

void main()
{
Test t; //let assume this was intended. Otherwise the fault starts here.

    // ..

    if(!t)
        throw TheYouIdiot_Exception;  // problem solved.

    t.Value++;
}

Reply via email to