4 ms·
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
by Gibbon1 3y ago
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.
- madeofpalk 3y agoUsing 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.
- Cthulhu_ 3y agoIn Go that's the zero value, which is usually things like empty string, 0, [], etc; in most cases that's good enough.