Hacker News new | ask | show | jobs
by josephg 2 days ago
Returning to the context of this post, this is one of the things I really like about rust. (And zig, haskell, typescript, swift and others). These languages make invalid states impossible to represent. If my function takes a value of type T (or &T), you can't accidentally receive NULL. So you just don't need to worry about this stuff any more. The compiler simply won't compile the program if type checking fails. At runtime, I only have to consider valid values.
1 comments

Zig still doesn't have a way to represent that a pointer to a heap allocated region is no longer valid.