Hacker News new | past | comments | ask | show | jobs | submit login

That wasn't the greatest example as Go doesn't really have any way to represent it. If it did it might be something like this.

  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.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: