• @davidagain@lemmy.world
      link
      fedilink
      1
      edit-2
      5 months ago

      The problem isn’t having empty values, it’s not tracking that in the type system, so the programmer and the compiler don’t have any information about whether a value can be null or not and the programmer has to figure it out by hand. In a complex program that’s essentially completely impossible. The innocently created bomb that causes your program to crash can be in absolutely any value.

      There are ways to track it all by disallowing null and using optional values instead, but some folks would rather stick with type systems that haven’t moved on since the 1960s.

    • Rikudou_SageA
      link
      15 months ago

      Depends on your language. In PHP nulls are completely sane (weird, but true), same in Typescript etc., while in Java, C#, C++ and similar it’s extremely stupid, because any reference type (pointer in C++'s case) can be null and it’s hell to work with.

      Generally, newer languages (or old languages where the type system itself is new-ish, like PHP and js/ts) handle null sanely.