Lack of null safety is still a major shortcoming in my book compared to Rust/Swift/Typescript.
Lack of enums and pattern matching is IMO the bigger issue. I miss that regularly.
function foo(x: number) {
return x + 1;
}
let y = null;
foo(y); // compiler will flag this func foo(x int) { return x + 1 }
var y *int = nil
foo(y) // compiler will flag thi type MyStruct struct {
Name string
}
var-not-nil myStruct = &MyStruct{"Hello"} // this is a "not-nil" pointer variable
myStruct = nil // compiler would catch this
The idea being to allow variables to hold and pass pointers to structs like now but ensure they are never nil.