News for hackers. Stuff that matters.
Re:Ten Years of “Go: The Good, the Bad, and the Meh by fsociety on Tuesday July 18, 2023 @12:22PM (#36775013)
Nil is a carefully chosen name in Go, and was a trade-off which was made. It’s not quite right to compare it to null in other languages.

I agree it is not as safe as a language like Rust, however it was the right trade-off to make in my opinion.

The main protection you have against nil pointers are nil receivers, and knowing when to use reference semantics vs value semantics.

Re:Ten Years of “Go: The Good, the Bad, and the Meh by veber-alex on Tuesday July 18, 2023 @12:25PM (#36775064)
What's the tradeoff? what advantage having null pointers give?
Re:Ten Years of “Go: The Good, the Bad, and the Meh by xchkr1337 on Tuesday July 18, 2023 @12:33PM (#36775238)
default values for everything without significantly increasing language complexity
Re:Ten Years of “Go: The Good, the Bad, and the Meh by masklinn on Tuesday July 18, 2023 @01:32PM (#36776284)
As far as I'm concerned, that's a drawback. Ubiquitous default values are an attractive nuisance. One which C# had already demonstrated 10 years prior.

The removal of nil leading to the removal of ubiquitous default values would have been positive.

Re:Ten Years of “Go: The Good, the Bad, and the Meh by 6D794163636F756 on Tuesday July 18, 2023 @01:45PM (#36776482)
I think that's why people in this thread are calling it a tradeoff. It's a very attractive option that seems like a great idea until it breaks. In happy path having default values is better, in mixed path situations, having a separate and reserved way of saying something hasn't been touched is incredibly powerful
Re:Ten Years of “Go: The Good, the Bad, and the Meh by 708145_ on Tuesday July 18, 2023 @02:19PM (#36777010)
I think default values are a major flaw, much worse than nil. An unintended default value causes data corruption. All types should be nillable in my opinion, using types that have fallback to a default value is source of nasty silent bugs. In Java for example I would never use a primitive data type.