3 ms·
The point about null references is a very good example. In both Rust and GC'd languages whose type system differentiates between null and non-null pointer type
by SamReidHughes 7y ago
The point about null references is a very good example. In both Rust and GC'd languages whose type system differentiates between null and non-null pointer types, it is impossible to define a type like Vector<T>, where T doesn't have a default constructor, without resorting to some form of type cast.
In Rust, as well as GC'd languages like TypeScript, dereferencing a null reference is possible, in the same sense, because a type cast or unsafe code may have been incorrect.
- Filligree 7y ago> In Rust, as well as GC'd languages like TypeScript, dereferencing a null reference is possible, in the same sense, because a type cast or unsafe code may have been incorrect. True, but type casts are unsafe code. You'll never see a null pointer so long as you stick to the safe language subset.