Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not to defend the OP because I agree that null is bad. But, in my limited experiecne with Swift I just add a few characters at the right place and the null's are now incorrectly ignored and the warnings go away. So, the language gave me warning, but it didn't really force me to deal with it correctly. Is Swift a bad example of a null-safe language?


What characters exactly? "!"?

You literally tell it to break, a null-safe language will not actually prevent you from shooting your foot, it'll just make sure you do so knowingly. "foo!" is essentially a shortcut for

    guard foo else {
        fatalError()
    }


> I just add a few characters at the right place and the null's are now incorrectly ignored and the warnings go away. So, the language gave me warning, but it didn't really force me to deal with it correctly.

Personally I don't really see that as an issue, we're talking about null safe by default vs not safe by default. It being simple to break the null-safety is a good thing, as long as it requires you to do it deliberately


It's a language that didn't go all the way to null-safety.

But at least it did explicit (you HAD to add those characters) to get the unsafety than in C is the default.


> It's a language that didn't go all the way to null-safety.

Is it? I can’t think of any langage but Elm which doesn’t have that assertion. Though I guess e.g. Idris or ATS could have left out as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: