News for hackers. Stuff that matters.
Re:I am not yet ready to switch to Zig from Rust by archgoon on Friday June 14, 2024 @12:29PM (#40682236)
I think you meant

  type Human struct {
     Name string
     MaybeHasCat *Cat
  }
As you have written (not making MaybeHasCat a pointer), go will correctly initialize (at least as of go1.20.5) the nested Cat structure and allow for direct assignment.

Having a null pointer exception for a null pointer is a behavior I would expect. Having one for a non-pointer structure would be surprising.

There are no comments on this comment yet.