Marc Sigrist

My feedback

  1. 338 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…)
      5 comments  ·  Visual Studio IDE » IDE and Editor  ·  Flag idea as inappropriate…  ·  Admin →
      Marc Sigrist commented  · 

      In the current implementation, C# Interactive is not user friendly enough for widespread success.

      Editing in the C# Interactive Window is too cumbersome except for very small code samples. The alternative, sending code from a cs file to C# Interactive with Ctr+E,Ctr+E, is usually not practical, because 1) a cs file has additional code mixed in that is not currently needed for interactive evaluation, and 2) interactive compiler directives are not available in the cs file.

      Adding a csx editor to Visual Studio is a prerequisite to make C# interactive truly successful. This can be seen from F#, where F# interactive is heavily used by each and every F# programmer. See also https://docs.microsoft.com/en-us/dotnet/fsharp/tutorials/fsharp-interactive/.

      Marc Sigrist supported this idea  · 
    • 5,465 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…)
        96 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
        Marc Sigrist commented  · 

        @Daniel Babralace: "Microsoft should really expand ? to be used for all types [...]" That's exactly what they will do in C# 8. See also https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md and https://github.com/dotnet/csharplang/blob/master/proposals/nullable-reference-types.md.

        Marc 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 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 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 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 Sigrist shared this idea  · 
      • 8,227 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  ·  382 comments  ·  Visual Studio IDE » .NET  ·  Flag idea as inappropriate…  ·  Admin →
          Marc Sigrist supported this idea  · 
        • 22 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 Sigrist shared this idea  · 
          • 510 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 Sigrist supported this idea  · 
              Marc 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.

            • 206 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…)
                13 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
                Marc Sigrist supported this idea  · 

              Feedback and Knowledge Base