News for hackers. Stuff that matters.
Re:Go: Support for Generic Methods by TheChaplain on Wednesday May 27, 2026 @08:39AM (#48293359)
It's not a bad thing to realize that one can be wrong and then strive for change.
Re:Go: Support for Generic Methods by a-french-anon on Wednesday May 27, 2026 @08:50AM (#48293473)
Maybe, but personally I've become quite tired of programming languages "organically grown" as opposed to properly designed the first time. After a good decade of C then C++, I found ANSI CL (despite being a massive compromise and unfinished) much more coherent and complete than both.
Re:Go: Support for Generic Methods by bbkane on Wednesday May 27, 2026 @09:05AM (#48293685)
I know Go is justly criticized for many of its design decisions, but it still feels well-designed and "small" to me in day to day usage when many other languages don't.
Re:Go: Support for Generic Methods by a-french-anon on Wednesday May 27, 2026 @10:59AM (#48295379)
Eh, the thing with generics coming late is pretty much what I meant by "organically grown".

My best litmus test these days is support for multidimensional arrays because it's always needed at some point in general purpose languages. CL and Ada had it right from the start while C++ needed C++23/26 to get std::mdspan and we still need to wrap it to pass the underlying/owned memory pool around (https://rosettacode.org/wiki/Multi-dimensional_array for more).

Re:Go: Support for Generic Methods by nish__ on Wednesday May 27, 2026 @11:28AM (#48295797)
Doesn't every language support multidimensional arrays? It's just an array of arrays, no? What am I missing?
Re:Go: Support for Generic Methods by umanwizard on Wednesday May 27, 2026 @12:40PM (#48296815)
An array of arrays is an extremely inefficient and error-prone way to represent multidimensional arrays.

If I want a 1000x1000 array, representing it physically as a single 1000000-element array requires one allocation, and processing it element-by-element (assuming it's stored in the same order we're iterating over it) is sequential in memory and therefore very efficient.

Representing it as 1000 separate 1000-element arrays requires 1000 allocations, and pointer-chasing every time we move from one row to the next.

Re:Go: Support for Generic Methods by j_w on Wednesday May 27, 2026 @02:42PM (#48298602)
Isn't an array of arrays by definition the sequential implementation?

Otherwise you would have an array of pointers to arrays. The usage (syntax) for them would be the same but the performance would not be.

They also have different uses. You would expect an array of arrays to be an array of arrays which share the same length. For an array of pointers to an array you would expect dynamic length arrays contained within the original array.

Even in c++ could you not just define some int [1000][1000]foo? I've never really used C++ but my C knowledge assumption is that is 1000000 continuous elements.

Re:Go: Support for Generic Methods by 20k on Wednesday May 27, 2026 @11:24PM (#48304095)
The C++ way to do it currently would be:

    std::array<std::array<T, N>, M> data;
Which is contiguous

    int data[M][N]; 
also works fine and is contiguous in C++

Edit:

For the stack at least. On the heap, you'd need to use a single std::vector<int> and do the indices manually, or use mdspan

Re:Go: Support for Generic Methods by uecker on Thursday May 28, 2026 @01:16AM (#48304853)
I does not work fine in C++ when N and M are not compile-time constants, which is basically always the case in any interesting numerical algorithm. Also not in Rust.

It works fine in C though, or FORTRAN, or Ada, or ALGOL 60, ...

Re:Go: Support for Generic Methods by pjmlp on Thursday May 28, 2026 @06:03AM (#48306841)
Which is why std::mdspan exists, and std::linalg.

NVidia has pivoted to design CUDA hardware with focus on C++ back in , and seems to be doing quite well for them.

CppCon 2017: "Designing (New) C++ Hardware”

https://www.youtube.com/watch?v=86seb-iZCnI

They were also the ones sponsoring the ISO work on mdspan, while HPC research labs are pushing for linalg on top.

I would rather be using Ada today, but that isn't how the world moves.

Re:Go: Support for Generic Methods by uecker on Thursday May 28, 2026 @01:39PM (#48312553)
I see that they spend time making their hardware run general software, but I can't see anything specific in GPU hardware to std::mdspan.

I respect Ada but I would not want to use it. But I have a choice between C++ with hmdspan and C99's arrays, I choose C99 any time.

Re:Go: Support for Generic Methods by pjmlp on Thursday May 28, 2026 @04:14PM (#48314796)
I guess you aren't their target customer anyway, NVidia isn't that found of pure C code, with first class tooling for C, C++, Fortran, Python JIT, Ada and most recently Rust.

The std:mdspan proposal came from NVidia employees, alongside AMD and HPC research labs.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p00...

Yeah, I remember discussions on comp.lang.c calling programming with Ada, or even Modula-2, programming with straightjacket.

Meanwhile governments and national security bodies got another point of view.

You mean the C99 arrays Google paid the work to clean from the Linux kernel?

Re:Go: Support for Generic Methods by uecker on Thursday May 28, 2026 @04:26PM (#48314965)
The thing is that I rewrite high performance numerical code on GPUs and the CUDA part is what sucks most. And the moment one uses templates, the compilation times make it insufferable. I really do not understand why people put up with this garbage. I am really looking forward to the day where I can remove CUDA from my projects and replace it with compiler-supported offloading is really

The kernel removed VLAs, I am more talking about vm types. But even for VLA - while I had a small role in that undertaking myself - I think it was a stupid mistake from a security point of view to remove VLAs from the kernel. Google pays for a lot of nonsense...

Re:Go: Support for Generic Methods by OneWingedShark on Thursday May 28, 2026 @03:12PM (#48313958)
Why is that? I find Ada much nicer than the C-languages when it comes to arrays: A'Range, A'Length, A'First, and A'Last are super-useful, as is the unconstrained array.

You can even use unconstrained arrays to provide the same functionality that Optional does in functional-programming, provided the element-type can be an element of an array:

    -- Here we define an index-type with one value.
    Subtype Boolean_Index is Boolean range True..True;
    -- And here we define an array indexed by it, but can also have length 0.
    Type Optional(Boolean_Index range <>) of Element;
And there you have the mechanism for Optional; just use "For Object of Optional_Array Loop" to enclose your operations and bam, it works perfectly.
Re:Go: Support for Generic Methods by shakow on Thursday May 28, 2026 @03:26AM (#48305768)
> Even in c++ could you not just define some int [1000][1000]foo?

If it fits on the stack, yes.

Typical code using MD-arrays is scientific code, and the data they manipulate generally do not fit there.

Re:Go: Support for Generic Methods by j_w on Thursday May 28, 2026 @08:22AM (#48307914)
Would the compiler not allocate the memory contiguously on the heap in that case then? Seems like a reasonable thing to do.
Re:Go: Support for Generic Methods by shakow on Friday May 29, 2026 @05:22PM (#48329456)
Nope. The C++ memory models is designed around no hidden/non-deterministic memory allocation.

If you try to allocate 10MB on the stack, that's the dev problem if the program fails, it's not the compiler job to guesstimate whether something will fit there or not (and it's impossible anyway, the compiler can't know all the stack sizes a program will ever run on).

Re:Go: Support for Generic Methods by nish__ on Wednesday May 27, 2026 @01:23PM (#48297447)
I see. That makes sense.
Re:Go: Support for Generic Methods by xscott on Wednesday May 27, 2026 @09:18AM (#48293874)
Scheme is (or at least was) coherent. You don't need to look any further than set/setf/setq to see that Common Lisp is "organically grown" from the fertilizer of a committee. CL does its best to make every other lisp more attractive.
Re:Go: Support for Generic Methods by rootnod3 on Wednesday May 27, 2026 @09:22AM (#48293933)
Which Scheme are we talking about? R5RS? R7RS-small? R6RS? With SRFIs? Without? Which scheme? Is it `(library...)` or `(define-module...)`?
Re:Go: Support for Generic Methods by xscott on Wednesday May 27, 2026 @09:33AM (#48294122)
Heh, I'd probably take R4RS with define-syntax :-)
Re:Go: Support for Generic Methods by rootnod3 on Wednesday May 27, 2026 @01:02PM (#48297139)
I mean, good choice, but you see the point, right? As much as ANSI CL has it's flaws, it has a standard, as much of a mixed bag it might be. Scheme is just a general potpourri of "we kinda have a guideline, but do whatever".

I would very much prefer scheme if the different implementations had a working standard. But I can't take my Chez-scheme code and throw it into Guile-scheme.

But pretty good chance I can take my ECL code and throw it into SBCL or LispWorks.

Re:Go: Support for Generic Methods by xscott on Wednesday May 27, 2026 @06:39PM (#48301730)
> you see the point, right?

Bah, I think this debate was already old when I first saw people arguing it on comp.lang.lisp in the 90s. I don't have a dog in this fight other than to reject the notion that Common Lisp is "coherent" and not "organically grown".

The original Scheme belongs in the category of languages like Standard ML and SmallTalk, where a small, careful, and talented group designed them with focus. Common Lisp seems like a bunch of smart people with competing interest and legacy baselines tried to meet in the middle. To the extent CL is more pragmatic, it's another example of "Worse is Better".

Re:Go: Support for Generic Methods by rahen on Wednesday May 27, 2026 @10:50AM (#48295239)
Scheme has a coherent and minimalist design, but its ecosystem and abstraction facilities feel too sparse for large applications.

When I started building a Lisp-based machine learning framework, Guile seemed like the right choice because it provides GOOPS and generic functions, yet I still ended up with a lot of boilerplate to compensate for the lack of a strong type system.

Scheme feels to me like C is to C++: not ergonomic for large-scale application development. Go is one of those languages that has both minimalism and productivity.

Re:Go: Support for Generic Methods by a-french-anon on Thursday May 28, 2026 @04:00AM (#48306016)
Common Lisp didn't grow into its warts, though, it was intentionally a "Common" Lisp. A compromise, like I wrote.
Re:Go: Support for Generic Methods by ndr on Wednesday May 27, 2026 @09:03AM (#48293651)
"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."

-- Greenspun's tenth rule

He had some lack of conviction to scope it so narrowly.

Re:Go: Support for Generic Methods by pizza234 on Wednesday May 27, 2026 @11:35AM (#48295882)
It isn't realistic to expect a design to be "proper in first place" because requirements change; my opinion is indeed the opposite - I find it natural for programming languages to have a (sort of) lifespan, and for new ones to (sort of) take their place.
Re:Go: Support for Generic Methods by someone_19 on Wednesday May 27, 2026 @12:27PM (#48296640)
Indeed, in 2012, it was not clear to anyone that generics were needed /s
Re:Go: Support for Generic Methods by array_key_first on Wednesday May 27, 2026 @08:24PM (#48302635)
Sure but literally everyone and their mom said these features were needed and then Go team said "nuh uh!!!" But, as it turns out, they are needed because they solve real problems, and are not just fake complexity like some people strawman.

Hopefully next they can add some error handling syntax and controls.

Re:Go: Support for Generic Methods by ramon156 on Wednesday May 27, 2026 @08:59AM (#48293599)
So which language had it right from the start? is there a language that has a very low rewrite status?
Re:Go: Support for Generic Methods by poncho_romero on Wednesday May 27, 2026 @11:14AM (#48295595)
I think Elixir is a good candidate here. It's small, coherent, and composes well, and (at least to my understanding) the authors consider the language finished, with no new major features planned.
Re:Go: Support for Generic Methods by sunsetSamurai on Wednesday May 27, 2026 @11:07PM (#48303945)
Elixir is missing static types though, it's hard to go back to work on dynamic languages.
Re:Go: Support for Generic Methods by shakow on Thursday May 28, 2026 @03:29AM (#48305800)
Re:Go: Support for Generic Methods by bbkane on Wednesday May 27, 2026 @09:06AM (#48293706)
I'd particularly like examples of statically typed languages that "got it right" (since I love me my types)
Re:Go: Support for Generic Methods by galangalalgol on Wednesday May 27, 2026 @09:40AM (#48294205)
Ocaml maybe? Multi threading didn't seem necessary and introduced the possibility of data races.
Re:Go: Support for Generic Methods by maccard on Wednesday May 27, 2026 @09:12AM (#48293787)
That’s whataboutism - no language is perfect, but given when go released it’s fair to hold them to a higher standard than languages what were designed 25 years earlier.

As an aside - D, Zig, Rust, even typescript got most of the lessons learned from C right

Re:Go: Support for Generic Methods by blanched on Wednesday May 27, 2026 @10:19AM (#48294817)
I'm not familiar with D, but Zig and Rust are well-known for continuously evolving.

Zig has the (in)famous "Writergate": https://github.com/ziglang/zig/pull/24329

And besides Rust's high count of RFCs, there are things like async (I'm not complaining about it, but its an obvious large-scale "change"), module system changes, etc.

(To be clear, I like both languages a lot. But I wouldn't call them slow moving or right from the start.)

Re:Go: Support for Generic Methods by Maxatar on Wednesday May 27, 2026 @11:23AM (#48295716)
D literally can't even maintain backwards compatibility between minor version updates not to mention a big part of the D community left when D reinvented itself with D2. Among languages it's probably the one that is constantly in a state of flux.
Re:Go: Support for Generic Methods by sunsetSamurai on Wednesday May 27, 2026 @11:09PM (#48303965)
what's a big project built with D? I feel it gets mentioned a lot on hackernews but I've never run into any project using it in the wild.
Re:Go: Support for Generic Methods by Kapendev on Sunday May 31, 2026 @05:24AM (#48344227)
Flutter
Re:Go: Support for Generic Methods by Kapendev on Sunday May 31, 2026 @05:41AM (#48344310)
Really? Wow, this is like Zig and I love Zig!
Re:Go: Support for Generic Methods by rootnod3 on Wednesday May 27, 2026 @09:23AM (#48293947)
ANSI CL is such a breath of fresh air nowadays. Does what you need, doesn't get in your way, comes with batteries included. And conditions are just god-tier.
Re:Go: Support for Generic Methods by shakow on Thursday May 28, 2026 @03:28AM (#48305796)
> comes with batteries included

I like CL, but I can't agree that a stdlib that doesn't even have a string split function is batteries-included.

Re:Go: Support for Generic Methods by nobleach on Thursday May 28, 2026 @08:01AM (#48307710)
And to bring it full-circle, this is the exact same thing I run into with Go. When I mention how nice it is that Lang X has feature Y, someone is quick to point out that either, "You can BUILD that in Go" or, "You don't really need feature Y". We've proven that we don't really NEED compilers either... but I would hate to have to do my job without them.
Re:Go: Support for Generic Methods by iosjunkie on Wednesday May 27, 2026 @10:56AM (#48295333)
"properly designed" - ah yes, programming languages are famous for universally agreed upon design philosophies.
Re:Go: Support for Generic Methods by skywhopper on Wednesday May 27, 2026 @12:26PM (#48296615)
You may be tired of languages evolving over time, but there is no other way to build a rich and useful language.
Re:Go: Support for Generic Methods by boxed on Wednesday May 27, 2026 @09:56AM (#48294451)
I liked Objective-C (except the C parts). Such a breath of fresh air coming from C++ which was grown like a cancer with tons of features and you felt trapped by every one of them.

Objective-C in contrast was a very few additions thoughtfully added that composed cleanly and freed the programmer to actually get things done.

Re:Go: Support for Generic Methods by fhn on Wednesday May 27, 2026 @11:16AM (#48295643)
so make your own and let's see how you do
Re:Go: Support for Generic Methods by chlorion on Wednesday May 27, 2026 @02:25PM (#48298353)
I am actually working on my own language, and getting something better than Go is actually not that difficult!

The hard part about making a language is creating the stdlib and tooling and support for the language, but actually creating a language itself that has more features and better features than go can be done by a single person in a few months or a year probably, depending on how much experience they have.

Generics specifically are a great example here. A single person can implement a language with go-level generics fairly easily.

Re:Go: Support for Generic Methods by rootnod3 on Wednesday May 27, 2026 @11:54AM (#48296141)
Have you?
Re:Go: Support for Generic Methods by maccard on Wednesday May 27, 2026 @09:08AM (#48293729)
There’s a fine line between being willing to change your mind and getting the basics wrong. Go has repeatedly gotten the basics wrong.
Re:Go: Support for Generic Methods by whoiskevin on Wednesday May 27, 2026 @09:23AM (#48293948)
Declaring a highly successful language as having the basics wrong means that you are not correct about the basics that were needed.
Re:Go: Support for Generic Methods by maccard on Wednesday May 27, 2026 @09:39AM (#48294202)
Something can be highly succesful in spite of having glaring design flaws. Nobody is claiming go isn't wildly succesful, but it's _in spite_ of these issues. It was clear over a decade ago that iota, gopath, and lack of generics were massive kneecaps to the language; go changing it's mind on those things isn't progress it's just getting the fundamentals wrong.

A good example of where they're kind of stuck is date formatting - it's stupid, unclear, and likely a mistake, but it's not a fundamental flaw; it's just a quirk.

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @09:59AM (#48294507)
Why is iota a massive kneecap to the language? It is semantically identical to enum in C and Typescript.

The trouble is that Rust is older than Go and it was already confusing people into thinking enums and sum types are the same thing, so by using slightly different syntax, iota, Go avoided the whole confusion of users thinking that enums would behave like sum types instead of actual enums.

Is your attempt at making a point that not having sum types is the massive flaw? Sum types are a useful construct, to be sure, but there are plenty of good languages without them. That's more on the design quirk end, realistically.

Re:Go: Support for Generic Methods by maccard on Wednesday May 27, 2026 @10:12AM (#48294710)
> Why is iota a massive kneecap to the language? It is semantically identical to enum in C and Typescript.

iota is a massive kneecap _because_ it's semantically identical to enum in C and Typescript.

> Is your argument actually that not having sum types is the massive flaw? Sum types are a useful construct, to be sure, but there are plenty of good languages without them. That's more on the design quirk end, realistically.

In a dream world sure we'd have full blown sum types (and that would give a result type which would also solve a lot of the nil-interface-combined-with-error-handling issues that I've ran into when working with go), but I can forgive that. The problem is this - https://www.zarl.dev/posts/enums

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @12:36PM (#48296761)
> The problem is this - https://www.zarl.dev/posts/enums

The only case I see made in there is that it doesn't like how Go implicitly converts consts. While that may be a reasonable criticism, it doesn't have anything to do with iota. It is related to the type system and applies in general. Consider the same problem exhibited here:

    type Email string
    func Send(email Email)
    func() { Send("invalid") } // Converted string const does not satisfy Email type expectations
Perhaps you accidentally offered the wrong link?

It was made abundantly clear when Go was released that it was intended to "feel like a dynamically-typed language". Being able to pass arbitrary values is perfectly in line with a dynamically-typed language. Realistically, the type system in Go is there to give the compiler optimization hints, not to offer type safety. Go was targeted at those wanting to use Python, without the programs being painfully slow to run. How much of a kneecap is implicit type conversion, really, when it is already in line with what the target audience is accustomed to? It is a quirk at best.

Re:Go: Support for Generic Methods by maccard on Wednesday May 27, 2026 @01:29PM (#48297535)
> It was made abundantly clear when Go was released that it was intended to "feel like a dynamically-typed language".

If I google this quote a comment from you comes up here on this exact topic, where you seem to have completely missed the point there too. If I link to the docs [0], the full quote is "It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language. " So it is a statically typed language first and foremost. If you want to rehash the discussion and tell people that a flawed type system that people have been asking for a solution to for close to a decade [1] you can just re-read the last time the arugments were made as I don't think I'm going to make any headway there.

[0] https://go.dev/doc/ [1] https://github.com/golang/go/issues/19814

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @01:45PM (#48297761)
> So it is a statically typed language first and foremost.

Right, because that is primarily how it makes things fast. Python is slow largely because it spends an inordinate amount of time trying to figure out what things are. Go knows what things are at compile time because the static type system tells it what things are and thus doesn't have to waste runtime compute on figuring out what things are, aside from when you use the reflect package, like Python does. That was its value-add — that it is kind of like Python, but faster. We already went over this...

> If I link to the docs [0]

I said original announcement, so I'm not sure why you wouldn't look there? Trying to be obtuse on purpose? Regardless, performance was indeed considered more important than being dynamically-typed. After all, if performance wasn't a concern then you'd just use Python. Go exists only because it was solving a problem that wasn't already solved. Slow Python was already solved. Type safety was already solved. It didn't need to go into those territories.

Re:Go: Support for Generic Methods by jolux on Wednesday May 27, 2026 @10:10AM (#48294679)
Rust is technically older than Go, but who was actually using it when Go 1.0 came out in 2012? Rust 1.0 wasn’t until 2015.
Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @10:13AM (#48294717)
The social landscape doesn't depend on anyone actually using it. However, 1.0 isn't a significant milestone like you suggest either. For a current example, Zig is relatively popular today despite not yet reaching 1.0.
Re:Go: Support for Generic Methods by stouset on Wednesday May 27, 2026 @02:48PM (#48298681)
Do you just forget the things you write in earlier comments?

> Rust is older than Go and it was already confusing people into thinking enums and sum types are the same thing

Of course the social landscape depends on people actually using it. None of the people who weren’t using Rust at the time were magically confused about enums and sum types by the mere existence of some new and experimental language.

Rust barely existed at the time Go was first being developed. And given the history of Go and the notoriety of its core team for flatly ignoring prior work in programming languages, it’s extremely unlikely that Pike et al gave more than a cursory glance to what nascent Rust was doing at the time.

But even if they had, to suggest that they intentionally replicated a dumb thing from C but gave it a different name to avoid users being confused by a different thing from a language that roughly nobody knew about at the time is bananas.

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @03:39PM (#48299451)
> Of course the social landscape depends on people actually using it.

That's nonsense. Brainfuck has shaped the social landscape despite effectively nobody using it, and absolutely nobody using it for any real work. The social landscape is not at all dependent on use.

> And given the history of Go and the notoriety of its core team for flatly ignoring prior work in programming languages

Huh? Go comes straight out of prior work. It is nearly indistinguishable from Alef. What the Go language flatly ignored was being innovative. Reasonably so, of course. It wasn't trying to innovate in programming languages so that we'd have another to throw on the heap of languages nobody uses. It was trying to solve a specific business problem using well-established methods.

Re:Go: Support for Generic Methods by stouset on Wednesday May 27, 2026 @01:34PM (#48297612)
> Why is iota a massive kneecap to the language? It is semantically identical to enum in C and Typescript.

So is nil. Care to make the same argument?

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @02:21PM (#48298298)
Typescript has something resembling nil as inherited from Javascript, so presumably that's what you are referring to. C and Javascript are the most widely used languages in existence. Clearly they weren't kneecapped. It mightn't be to your preference, but "I don't like it" would be an atypical use for the word "kneecap".

There is a stronger case to be made for the other two. Calling GOPATH a design mistake is a stretch as it was perfectly suited to use within Google, but it didn't fit the typical solo developer's environment. Lack of generics made writing certain types of code difficult. You could be convincing in suggesting that Go did end up being used less than it otherwise would have because of those choices.

iota? It's just a construct that generates numbers (an enum). How does that kneecap anything? If it really bothers you, you can manually number the values by hand instead. Why would anyone reject a language because it allows you to optionally choose to have the compiler assign numbers automatically instead of forcing you to do it manually? The answer is nobody. In fact, most popular languages have something equivalent to iota.

Re:Go: Support for Generic Methods by stouset on Wednesday May 27, 2026 @02:35PM (#48298497)
Nil exists in C and is widely considered to be a massive mistake in the language. An understandable one at the time, but a mistake nonetheless.

Thus “go borrowed it from C, therefore it can’t have been a mistake” is a pretty lame take. The whole point of a new language is to make improvements on what’s out there already. Go missed an opportunity to fix one of C’s most notorious mistakes. So yes, they kneecapped themselves by forcing all of the users of Go to continue dealing with this well-known footgun.

Does it mean Go isn’t popular? Of course not. C was popular. PHP was popular. JavaScript is popular. Go is popular. This is always in spite of their faults. But Go could have been better.

Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @02:49PM (#48298693)
> Nil exists in C and is widely considered to be a massive mistake in the language.

You're almost there, but it is wildly considered to be massive mistake in context of arrays. C has weird array semantics that are confusing and hard to get right, even for seasoned developers. That is where NULL comes to bite people time and time again. Go did not inherit C's arrays. Neither did Javascript. They go out of their way to avoid what C did. In Go, you can come close to the same semantics if you use the unsafe package, but take note the name.

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. There are many other things that are more likely to end up being misused. Those would be the more massive mistakes.

> But Go could have been better.

Obviously. Every language ever created can be better.

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...

Re:Go: Support for Generic Methods by reilyroadster on Thursday May 28, 2026 @06:25AM (#48306990)
Nil is not the problem, practically every language has such a concept - it's pretty much required to make things like Maybe/Optional work.

The problem is the implicitness of it and how easy it is to produce them and forget to check for them.

Re:Go: Support for Generic Methods by n6242 on Wednesday May 27, 2026 @10:04AM (#48294586)
By that logic Windows would be the best operating system ever and perfect in every way, and anyone who disagrees must be wrong about how an OS should be.
Re:Go: Support for Generic Methods by hocuspocus on Wednesday May 27, 2026 @10:09AM (#48294664)
And Javascript and Python the best languages.
Re:Go: Support for Generic Methods by jeswin on Wednesday May 27, 2026 @09:38AM (#48294191)
It's a highly successful language because (1) it was backed by Google, and (2) created by Robert Griesemer, Rob Pike, and Ken Thompson.

If it came out of anywhere else, it might have struggled even to hit the homepage here.

Re:Go: Support for Generic Methods by amazingamazing on Wednesday May 27, 2026 @09:40AM (#48294213)
This logic is easily shown to not hold. Why isn't Carbon, Dart, etc. not really popular then?
Re:Go: Support for Generic Methods by doodpants on Wednesday May 27, 2026 @11:12AM (#48295572)
I can't speak about Dart, but Carbon had just barely started development when it was first announced 4 years ago, and is currently presented as an experimental language that is not yet ready for use [0].

0: https://github.com/carbon-language/carbon-lang#project-statu...

Re:Go: Support for Generic Methods by no_wizard on Wednesday May 27, 2026 @01:28PM (#48297529)
Dart was relegated to effectively being Flutter. It was originally intended to supersede JavaScript but no other engine would commit to that. It failed at its initial goal and hasn’t really found a footing outside of Flutter.

Carbon is by its own admittance not ready to use and I think mostly relegated to solving Google’s problems with C++ right now.

Both of them didn’t ship with a standard library as robust as Go’s.

One thing that made Go popular out of the gate is it is extremely good fast to build out robust HTTP services and infrastructure.

This is a very common use case and they tailored Go to be a great fit for it. You can build your entire backend without a single third party module if desired using Go’s standard library and it isn’t terribly complicated to do so.

Re:Go: Support for Generic Methods by voidfunc on Wednesday May 27, 2026 @10:03AM (#48294559)
Its just bitter dorks bitter their pet language with cutting edge programming abstractions didnt make it to the big leagues.
Re:Go: Support for Generic Methods by someone_19 on Wednesday May 27, 2026 @12:32PM (#48296705)
So you mean to say that PHP5 and Js from 2007 had a well-founded design?
Re:Go: Support for Generic Methods by boxed on Wednesday May 27, 2026 @09:56AM (#48294460)
The basics of a programming language were wrong. The basics of marketing were very right. Those are not the same.
Re:Go: Support for Generic Methods by 9rx on Wednesday May 27, 2026 @09:35AM (#48294147)
An engineer, of course, understands that there is no such thing as "wrong", only different tradeoffs, but with the rise of "vibe coding" you don't need to be an engineer to play in the world of programming anymore.
Re:Go: Support for Generic Methods by OtomotO on Wednesday May 27, 2026 @10:05AM (#48294597)
cough JavaScript cough
Re:Go: Support for Generic Methods by ivanjermakov on Wednesday May 27, 2026 @06:15PM (#48301512)
Re:Go: Support for Generic Methods by pjmlp on Thursday May 28, 2026 @02:30AM (#48305379)
Yes, all great examples of language design. PHP, Java, JavaScript, C, C++, Go
Re:Go: Support for Generic Methods by Jleagle on Wednesday May 27, 2026 @09:11AM (#48293763)
Sounds like you want this feature, and you just got it. Not sure how that's wrong. You don't add in every feature from the start.
Re:Go: Support for Generic Methods by maccard on Wednesday May 27, 2026 @09:13AM (#48293799)
I wanted it 10 years ago.
Re:Go: Support for Generic Methods by tux3 on Wednesday May 27, 2026 @09:02AM (#48293644)
I don't think anyone admitted any wrong or had any big change in philosophy. It's always a good thing to learn something along the way. But the current message seems to be that this was the plan all along, and it just took some time to design properly.

Of course adding generics is not something that every language needs to do. Scripting languages like Ruby don't really need this style of generics. It doesn't fit the design of the language, and it's not even clear what that would look like in Ruby.

But static typing with generics does solve a recurring problem, and we've seen some real convergence towards type hints and type systems even in staunchly dynamic scripting languages. Modern Javascript is now mostly Typescript, and they've successfully retrofitted a very advanced type system in the last place I would have expected 20 years ago.

Re:Go: Support for Generic Methods by galangalalgol on Wednesday May 27, 2026 @09:13AM (#48293804)
Type hinting seems like the worst of both. You pay the cost on refactor to go change them all, where dynamic typing or static type inference avoid that. You also don't have any of the benefits of static or dynamic typing. My strong preference is static typing with good inference and an ide that shows the inferred types everywhere when asked. Dynamic typing can make some tasks dramatically easier, I'm just not capable of using them without making hideous mistakes.
Re:Go: Support for Generic Methods by layer8 on Wednesday May 27, 2026 @09:34AM (#48294137)
It’s still annoying ~20 years after Java did the same mistake of not including generics, which was already clear to many people with C++ experience back then.
Re:Go: Support for Generic Methods by someone_19 on Wednesday May 27, 2026 @12:38PM (#48296783)
...and Java didn't even have basic enums or sum types from the beginning. But it had null.

They added enums, they added sealed classes. They're trying to get rid of null (apparently it's really hard). The problem is that in 2012, when go 1.0 was released, this should have been obvious to everyone.

Here's a famous discussion from 2009, three years before the 1.0 release (tldr: facepalm)

https://groups.google.com/g/golang-nuts/c/rvGTZSFU8sY

Re:Go: Support for Generic Methods by layer8 on Wednesday May 27, 2026 @01:57PM (#48297943)
I remember back in 1995 thinking that it was stupid for Java not to have generics, so instead you had to always cast Vector/Hashtable elements from Object, or implement your own type-specific container classes for every element type (and there wasn’t even a preprocessor to facilitate the latter).

Sum types I didn’t really miss, because you can implement a type-safe equivalent using the Visitor pattern, and retain an interface-implementation separation that native sum types typically don’t provide.

Re:Go: Support for Generic Methods by symaxian on Wednesday May 27, 2026 @11:16PM (#48304026)
That is an interesting read, seems some were having a hard time grasping the benefit of having compiler checks for potential null dereferences. Having worked with null safety in TypeScript and Kotlin the extra bit of strictness is nice.
Re:Go: Support for Generic Methods by pjmlp on Thursday May 28, 2026 @02:36AM (#48305416)
The biggest design issue with adding value types and non nullable to Java, is that the number one design requirement of any solution is not to break Maven Central.

Every compiled JAR out there has to keep working as always on a JVM with updated semantics, and worse code has to be compatible, when passing class instances around between old and new code.

Then there are the guest languages on the JVM as well.

Re:Go: Support for Generic Methods by ivanjermakov on Wednesday May 27, 2026 @06:14PM (#48301499)
Worst thing a programming language can do is introduce core semantics changes after 1.0. See Python 2 -> 3 and Zig's *gates.
Re:Go: Support for Generic Methods by metaltyphoon on Wednesday May 27, 2026 @07:21PM (#48302134)
Except Zig is not 1.0
Re:Go: Support for Generic Methods by ivanjermakov on Thursday May 28, 2026 @03:40AM (#48305876)
Of course, just a good case study of how radical languge changes are received by users.