Marc SigristMarc Sigrist

My feedback

  1. 5,106 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      90 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
      Marc SigristMarc Sigrist commented  · 

      I am happy to note that this suggestion has been at the very top ever since I wrote it more than five years ago. To understand its popularity, one can simply enter "billion dollar mistake" into any search engine.

      Non-nullability is difficult to retrofit into a language like C#. There are many approaches, who solve the problem to varying degrees. Furthermore, the discussion is tricky, because people easily mix up the semantics of initialization, nullability, and optionality.

      It is all the more exciting that non-null refs are now in the status of prototyping for the next version after C# 7 (see https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md).

      Last not least: Several modern programming languages already _have_ null-avoidance features, such as F# (https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/values/null-values), Swift (https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Types.html#//apple_ref/swift/grammar/optional-type), or Rust (https://doc.rust-lang.org/std/option/).

      Marc SigristMarc Sigrist commented  · 

      There is a pater of 2003 from Microsoft Research: [Declaring and Checking Non-null Types in an Object-Oriented Language] (http://research.microsoft.com/en-us/um/people/leino/papers/krml109.pdf). Unfortunately, the initiative has not been followed through. However, some concepts look quite similar to what later became [NotNull] etc. in ReSharper.

      Marc SigristMarc Sigrist commented  · 

      @Vladislav: Yes, non-nullable reference types would make C# more "symmetric" (with nullable value types), which is in itself a good thing from a language design perspective.

      Marc SigristMarc Sigrist commented  · 

      As my suggestion has become somewhat popular, I would like to add more context to it. Null references were introduced in ALGOL in 1965. The language designer has famously described this as his "billion dollar mistake" (see
      http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare).

      The error has been copied by the mainstream OO languages, inclusign C#. By now, the worldwide costs of preventing and fixing NullReferenceExceptions might easily be in the range of a billion dollars a year.

      Given the seriousness of the problem, the correct thing to do would be to redesign C# (or even the .Net Framework) so that, by default, the usage of null is forbidden. To indicate that something might or might not exist, a new "Option<T>" or "Maybe<T>" type could be added, ideally with proper syntactical support in the language. An example of a .Net language who works like this is F#.

      However, I don't think it is realistic to expect such a fundamental change in C#, a long-established mainstream language. Therefore, I have suggested the second-best solution, which is to add non-nullable reference types. Of course, this would make C# a bit more complicated, as we would then have four "contingency idioms" (nullable vs. non-nullable value types vs. reference types). But it would still be less complex and expensive than the combined effort of ReSharper/CodeRush, code contracts, coding conventions, documentation, and testing,
      while still running the constant risk of NullReferenceExceptions.

      Marc SigristMarc Sigrist shared this idea  · 
    • 16 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        0 comments  ·  Visual Studio IDE » Languages - F# Tools  ·  Flag idea as inappropriate…  ·  Admin →
        Marc SigristMarc Sigrist shared this idea  · 
      • 498 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          under review  ·  15 comments  ·  Visual Studio IDE » Languages - F# Tools  ·  Flag idea as inappropriate…  ·  Admin →
          Marc SigristMarc Sigrist supported this idea  · 
          Marc SigristMarc Sigrist commented  · 

          Folders would be nice, or, as an alternative: Improving _object browser_ support in Visual Studio, so that the internal and private details of an F# project can be looked up in a structured way in "My Solution", as it is possible for other languages.

        • 187 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            12 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
            Marc SigristMarc Sigrist supported this idea  · 
          • 1,620 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              17 comments  ·  Visual Studio IDE » Languages - F# Tools  ·  Flag idea as inappropriate…  ·  Admin →
              Marc SigristMarc Sigrist supported this idea  · 

            Feedback and Knowledge Base