News for hackers. Stuff that matters.
Re:Go: Support for Generic Methods by stouset on Wednesday May 27, 2026 @02:51PM (#48298740)
> You're almost there, but it is wildly considered to be massive mistake in context of arrays.

From Tony Hoare: "I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object-oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years."

Odd that he wouldn't mention the word "array" anywhere in that quote.

> Yes, they still have nil, but the scope is tightly constrained and while it is technically possible to misuse, you have to try pretty hard to do so.

Like by not remembering to check if a pointer is nil? Or actually comparing one typed nil to a different typed nil?

> Obviously. Every language ever created can be better.

Only one of us is arguing that reimplementing C’s mistakes is actually a good thing.

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @02:57PM (#48298828)
> Like by not remembering to check if a pointer is nil?

Rule of thumb is to not introduce values that aren't valid. Equally, don't put in -1 for an age value, even if the language allows you to. You might later forget to validate that the age value is valid.

Yes, mistakes are possible, but these types of mistakes are pretty rare. There is some value in eliminating the possibility of those mistakes, sure, but we cannot pretend that it comes cost-free. There is good reason why almost nobody uses Rocq.

> Or actually comparing one typed nil to a different typed nil?

This is something that is likely to confuse, but not a facet of nil. It is related to interfaces. Let's not flail around like one of those wacky blow up things at the used auto lot.

Re:Go: Support for Generic Methods by stouset on Wednesday May 27, 2026 @04:42PM (#48300350)
Ah the good old “just be a perfect programmer and you won’t run into any issues” argument. Haven’t heard that one in awhile.
Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @05:22PM (#48300914)
If only you had made it to the second paragraph.

Hey, at least we can now understand why you have such a hard time with nil, so that's something.

Re:Go: Support for Generic Methods by shakow on Thursday May 28, 2026 @04:20AM (#48306169)
Your second paragraph doesn't hold after one minute spent reading the CVEs list.
Re:Go: Support for Generic Methods by foldr on Thursday May 28, 2026 @04:44PM (#48315202)
Nil references in Go aren't likely to be a source of CVEs. Dereferencing a nil reference is not undefined behavior in Go; it's guaranteed to panic.
Re:Go: Support for Generic Methods by shakow on Friday May 29, 2026 @05:24PM (#48329486)
Not all CVEs are RCE. This one[1] for instance is go's nil-dereference caused.

[1] https://access.redhat.com/security/cve/cve-2025-29785

Re:Go: Support for Generic Methods by foldr on Saturday May 30, 2026 @05:34AM (#48334370)
This is a bug that could also happen in Rust if someone used 'unwrap', or if the code panicked for any other reason. You can have logic bugs in any language. Remember the Cloudflare outage of Nov 2025.

It's also worth noting that the vulnerability you link to is a denial of service vulnerability. While yes, this is technically a vulnerability, it's not the sort of thing that people are usually worrying about in the context of null pointers. If features that give rise to DoS vulnerabilities are the ones to worry about, top of the list would have to be backtracking regex engines: https://owasp.org/www-community/attacks/Regular_expression_D...