Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s hard for me to believe that it is as simple as you suggest, considering the large amount of work put in by the Go team already, and the even larger amount of work put in by other programming language implementors to eventually arrive at various (different) design points. Work which often takes many years like C++ concepts.

Not to mention the open invitation for concrete proposals on how to add them Go.

You might find this post by one of the Go team members interesting:

https://news.ycombinator.com/item?id=9622417



As proven by the lack of progress, that invitation has just political value, it allows posts like yours when these discussions take place.

For example, while Valhalla has taken several years so far, OpenJDK team has experimental builds that you can go and play around with value types in Java.

Where are the experimental builds for generics support in Go?


> For example, while Valhalla has taken several years so far, OpenJDK team has experimental builds that you can go and play around with value types in Java.

Actually Valhalla is pretty interesting to think about. For what I'm currently working on, the inability to have a list of points without individually heap-allocating each one makes a language much more of a non-starter than the lack of user-defined parameterized types does.

Even back when Java was invented, there was plenty of prior art (going back decades) about efficiently representing a list of points in memory. Probably most of its predecessors could do it. Yet Java has lacked this basic ability for 25 years.

I even expect that when they eventually implement it it will work similarly to other popular languages, compared to Go which seems to be drawing on more recent developments (like concepts etc) for its generics design.

Despite this, I don't accuse the Java team of political machinations every time the topic comes up. Mainly because I don't believe that to be the case. Maybe they've prioritized a critical feature for me lower than I would like, but it seems like a substantial amount of work to implement because (like generics) it interacts with other language features in a complex way and (like generics) once they ship a design they will be stuck keeping backwards compatibility with it basically forever, so they only have one chance to get it right.


The difference being that Java teams deliver language improvements and go on the stand acknowledging where to improve and setting roadmaps, Go not so much.

Even stuff like error handling improvements and type alias were almost shot down.


> The difference being that Java teams deliver language improvements

Sure, I think it's fair to say they've focused a lot more on implementation and library changes and not language changes up until recently. Things like rewriting the compiler from C, improving code generation / escape analysis / GC, more platform / architecture support, improving the standard library, getting a reasonable package manager, etc.

So it seems a little premature to read some secret anti-generics stance into it (and it not just being a matter of priorities) since there were all these other areas that they were also way behind Java in.

After package management was in generics started showing signs of life again, so it all seems reasonably consistent with the Go team just wanting to clear other stuff off their plate first before tackling it. Hopefully we see it in a similar timeframe to major Java/C++ features now that it's being worked on more.

If there's any silver lining the actual proposals seem pretty ambitious, seems like they want to enable a lot more than just new type safe collections if they add the feature.


This actually exists. There’s a go playground earlier in this thread worth generics support


Which apparently hasn't been updated since August, 2019.

https://github.com/ccbrown/wasm-go-playground/tree/master/ex...

So this is the prototype used at the GopherCon talk.




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

Search: