• lysdexic@programming.devOP
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    2
    ·
    2 months ago

    With what in mind? Evading NULL?

    Depends on your perspective. It’s convenient to lean on type checking to avoid a whole class of bugs. You can see this either as avoiding NULL or use your type system to flag misuses.

    Languages that make use of references rather than pointers don’t have this Dualism. C# has nullable references and nullability analysis, and null as a keyword.

    C#'s null keyword matches the monadic approach I mentioned earlier. Nullable types work as a Maybe monad. It’s the same concept shoehorned differently due to the different paths taken by these languages.

    • baseless_discourse@mander.xyz
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 months ago

      as far as I know, C# don’t have proper ergonomic monadic bind as in F# (computation expression), Haskell (do expression), and Ocaml (let*), but I could be wrong.