Additionally, Swift has essentially the same approach to C FFI.
I imagine they might be good for performance (fewer checks), but does it really help with correctness/convenience/elegance/readability/etc?
YMMV
Dereferencing null is impossible, and the programmer is forced to explicitly handle null values.
This contrasts with C, where the same type is used for a nullable and a non-nullable pointer, so the compiler can't help out, the programmer is at risk of forgetting/failing to keep track of the difference between the two, and null-dereferences may occur (and give you undefined behaviour).
Java references take the same approach as C pointers, except all dereferences are checked at runtime, and dereferencing null throws an exception.
I like it! It does better than the Never null, only cromulent values approach (like C++ references), as this can be inconvenient in practice. It makes null-dereferences impossible, and doesn't do anything funky that would introduce needless runtime overhead.
* Type inference - var name = "Bob";
* Maybe types (from Elm/Haskell) that prevent NULL ptr bugs and syntactic sugar encourages its use for function return values.
* Nullable types - var ?&object = null; if you need it, and var &object = aObject; if you want the safety.* Great C interop, though there is more work to be done here. (gtk.h for instance is too much for zig today) Zig's approach is unique here too. You specify .h files in the zig source code and the zig compiler translates C in the .h into zig. Its not a function bridge or wrapper, its zig objects and zig functions available to your zig code.
* Standard library operations that allocate memory take an 'allocator object' parameter that should give great programmer control over memory management (I didnt get into this myself), webasm is a compiler target, and lots more