News for hackers. Stuff that matters.
Re:Featherweight Go by pjmlp on Sunday May 31, 2020 @08:59AM (#23369288)
Except that these kind of experiments contributed to Java generics, being made available 3 years before Go 1.0 was given a green light.

Which is why Go had already a good example to learn from on how not to do language design.

Re:Featherweight Go by eeh on Sunday May 31, 2020 @09:05AM (#23369321)
Are you suggesting all new typed languages have generics? What makes you so sure there isn't room in the design space for a typed language without generics?

As much as I like generics, Go's popularity is a success: programmers have spoken, and they value other things more than generics.

Hindsight is 20/20, and even this isn't a commitment to introduce generics in Go.

Re:Featherweight Go by pjmlp on Sunday May 31, 2020 @11:30AM (#23370156)
Go's popularity is due to author's employer.

Both its main influences, Oberon-2 and Limbo had zero traction on the market, and Limbo not only is quite close to Go, it had an whole OS full of the Plan 9 ideas to come along, yet it failed on the market.

Lack of generics has already been publicly acknowldge as problem.

> In three years of Go surveys, lack of generics has always been listed as one of the top three problems to fix in the language.

https://blog.golang.org/why-generics

And yes, there is no place on the 21st century for typed languages without generics, we already have enough of them from the previous century already.

CLU and ML, the first languages to support genericity are from the mid-70's, they are older than C++ and contemporary to C.

Re:Featherweight Go by dcu on Sunday May 31, 2020 @03:07PM (#23371795)
I think Go is popular because of its simplicity and fantastic standard library.

It can also feel sometimes like a dynamic language which has attracted people from ruby, python, JS, etc... communities.

You say there's no place for it in the 21st century, yet it already has a place and it doesn't really need generics to continue living.

Re:Featherweight Go by erik_seaberg on Sunday May 31, 2020 @06:21PM (#23373373)
Thanks to generics and lambdas, Java's standard library includes concurrent mapreduce. Lacking generics, Go's standard library can't even offer https://golang.org/pkg/sync/#Map without sacrificing type safety.
Re:Featherweight Go by eeh on Sunday May 31, 2020 @09:10PM (#23374654)
I agree Java streams and concurrent collections are great.

I agree Go cannot offer similar things due to a weaker type system.

I willingly code Go day-to-day. I miss Java streams, and sometimes the codebase is slightly worse due to the lack of Java streams (or equivalent).

I accept a weaker language because I spend less time debating the Right Way to do things (Go is too inexpressive to support a Right Way), and because I can widen my hiring pool from those that know Java, to those that any language, knowing that they can easily pick up Go.

Re:Featherweight Go by icholy on Sunday May 31, 2020 @01:14PM (#23370901)
> Go's popularity is due to author's employer.

Why isn't Dart seeing the same type of success?

Re:Featherweight Go by pjmlp on Sunday May 31, 2020 @02:57PM (#23371713)
Because it was dropped on the floor by the Chrome team, which lead to the original team leaving Google, if they had shipped Dartium the outcome would be much different.
Re:Featherweight Go by jstarks on Sunday May 31, 2020 @01:18PM (#23370932)
Is Dart's lack of popularity in spite of its author's employer, then?
Re:Featherweight Go by pcwalton on Sunday May 31, 2020 @04:04PM (#23372238)
Dart's lack of popularity is indeed in spite of the Google backing. I basically see two reasons. First, though Lars Bak has an impressive pedigree, Strongtalk and V8 aren't as well-known as Plan 9 and Unix. Moreover, rightly or wrongly, Dart had the appearance of "Google's attempt to kill JS", which neither endeared it to Web developers (who were riding a wave of JavaScript hype at the time) nor to other browser manufacturers (who were growing increasingly distrustful of Google's initiatives).
Re:Featherweight Go by pjmlp on Sunday May 31, 2020 @02:57PM (#23371719)
Because it was dropped on the floor by the Chrome team, which lead to the original team leaving Google.

Original Go team did not suffer from this.

Re:Featherweight Go by baby on Sunday May 31, 2020 @02:22PM (#23371454)
> Lack of generics has already been publicly acknowldge as problem.

That's from people who complain because they want Golang to be like Java

Re:Featherweight Go by pjmlp on Sunday May 31, 2020 @03:02PM (#23371754)
It is more people that don't want Go be a plain Limbo remake.
Re:Featherweight Go by jdub on Sunday May 31, 2020 @10:36AM (#23369838)
"programmers have spoken, and they"...'ve done quite a lot of work to get the benefits of generics without language support. You can pretty much look at any large Go project (famously Kubernetes) and see a workaround of some shape or form.
Re:Featherweight Go by smarterclayton on Sunday May 31, 2020 @11:05AM (#23370002)
Kubernetes has lots of workarounds - I’m not sure generics are the ones I’ve worried about the most.

If I had to write a list of “tools I would have preferred to have”:

1. Perfect serialization libraries - Serde is the gold standard here, and IIRC the macro system from Rust is as important a part of it as the traits part.

2. Mutability of types in shared caches - to build efficient controller patterns you need fast and efficient caches - an immutable type that protects against mutation would have saved a lot of ugly mutation testing code

3. Client library definitions shared across types - we could have reduced a fair amount of boilerplate with generics, although most bugs are in the serialization part these days as types evolve

But most of these are dwarfed by the need to scale reviewer time across hundreds of people submitting PRs that change fundamentals of the code. The simplicity of Go and ability to review stupid, obvious, absolutely critical code is the reason why I love it.

Having a strong way to reduce cleverness has been a godsend. It doesn’t mean cleverness is bad, or I don’t want more tools in Go. But I appreciate that aspect of Go in a way that others may not.

Edit: I have been watching kube-rs mature, but to get the same level of scale and performance we’d have to reproduce the shared index informers and that’s a lot of drudge work to get right. That’s one place where someone motivated could really help Rust become a first place way to extend Kubernetes, which would be exciting.

Re:Featherweight Go by entha_saava on Sunday May 31, 2020 @12:54PM (#23370770)
Hacker News law: In every thread about Go someone will bring up rust.

Don't mind.

Re:Featherweight Go by uluyol on Sunday May 31, 2020 @01:52PM (#23371221)
The comment you are replying to was written by one of Red Hat's lead kubernetes developers (https://github.com/kubernetes/kubernetes/graphs/contributors).
Re:Featherweight Go by saturn_vk on Sunday May 31, 2020 @03:39PM (#23372043)
While k8s's code is atrocious, I wonder if that isn't due to its legacy translation from Java (iirc, it was written in it initially)
Re:Featherweight Go by smarterclayton on Sunday May 31, 2020 @04:38PM (#23372519)
Kubernetes had a non-public prototype in Java. None of the code in the main tree even resembles the code from that prototype (I was one of the first non-googlers to contribute).

It’s just ugly because that’s how it evolved after a community formed and that’s what real evolved software looks like. :)

Re:Featherweight Go by meddlepal on Sunday May 31, 2020 @01:20PM (#23370956)
Go is popular because Google enjoys shoving it down our throats not because it is a particularly good language.

Not saying it is a bad language, but it really helps that Go had Google's blessing.

Re:Featherweight Go by fauigerzigerk on Sunday May 31, 2020 @02:51PM (#23371656)
Strange. I get the impression that Google's support for Go is rather half hearted.

Or perhaps Google has many hearts and no one knows exactly how many or where they are at any given point in time :-)

Re:Featherweight Go by icholy on Sunday May 31, 2020 @01:25PM (#23370990)
> Go is popular because Google enjoys shoving it down our throats

How exactly is Google "shoving it down our throats"?

Re:Featherweight Go by voidfunc on Sunday May 31, 2020 @01:23PM (#23370975)
Java had generics in 2004 w 1.5. Go didn't come onto the scene until 2012... so more like close to decade.
Re:Featherweight Go by frej on Sunday May 31, 2020 @10:07AM (#23369681)
I dont think expirements are a way to qualify decades of research that went before.

Second what Sun choose to implement was a smaller subset and not that close to Featherweight Java/pizza compiler. It was only generics, not first class functions at the time, nor algebraic types/pattern matching.