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

I feel like the pointer stuff you could handle safely in a modern language. Because I think pointer and array notation are convertible so one isn't scarier than the other.

But yeah not being able to tag pointers as 'can't be null' and have the compiler enforce that ignores everything we've learned in the last 40 years. You shouldn't be able to pass a potentially null pointer to a routine that can't deal with it. You end up with code finding a null pointer without any context that tells it what to do with that. Or it panics.



Using pointers just to get a 'null' is just an annoying hack reflective of poor design. Instead, "no value" should be able to be directly represented.


In Go that's the zero value, which is usually things like empty string, 0, [], etc; in most cases that's good enough.




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

Search: