← Back to context

Comment by sanderjd

5 years ago

What's a seg fault? I jest, but static languages have come incredibly far since C++ (where they are already less common than in C) and I truly haven't dealt with a segmentation fault in the past many years working with static languages.

My c++ code has so many someptr!= null checks it’s not even funny. But js has those same checks. What languages don’t?

  • Haskell, Kotlin, Scala 3 (with a compiler flag) will all remove null from the set of values acceptable by type. (There are others as well) So a String can’t be null ever, you have to do ‘Maybe String’, ‘String?’ or ‘String | Null’ as a type respectively. If this is what you are asking.

  • Also, maybe it's pedantic, but leaving out null checks in js will not result in a seg fault, it will result in an exception.

    • And that is different how, as far as a sign the programmer didn’t think the code thru and maybe you can get around some security controls?