Live data from Hacker News

Generics aren't ready for Go

drewdevault.com

231–238 of 238 posts

Re: Generics aren't ready for Go

#231

Earlier quoted context omitted.

>Go doesn't have generics, not from a lack of knowledge, but because the authors' real world software engineering experience had shown to them it wasn't important. What do you mean by "real world software engineering experience", Acme or Plan9? These are silly academic projects with tens of installations at best.

Ken Thompson was one of the original authors of Unix

We are discussing Pike's profound engineering experience which constitutes the background of his bold claims about language design.

Re: Generics aren't ready for Go

#232

Earlier quoted context omitted.

Ken Thompson was one of the original authors of Unix

We are discussing Pike's profound engineering experience which constitutes the background of his bold claims about language design.

So really this isn’t a discussion about the design of Go (of which Ken Thompson was a part of) but just a chance to trash on someone you don’t like.

Re: Generics aren't ready for Go

#233
post #211

Earlier quoted context omitted.

Yes those are two bloated stdlibs.

On the contrary, they are feature rich with capabilities that Go still hasn't found a proper way to support, like something comparable to Swing. Naturally turning into name calling is easier when running out of arguments.

Java hasn't found a proper way to support something comparable to Swing. :)

If Java's standard library is reasonably sized, what is your idea of a bloated standard library? How often do you use SOAP? Applets? Open MBean? CORBA? Relation?

> Naturally turning into name calling is easier when running out of arguments.

I like many of your posts. This one is just gratuitous ad hominem.

Re: Generics aren't ready for Go

#234
post #192

Earlier quoted context omitted.

Plan9 didn't go anywhere. So other than UTF-8, there's not much to speak of. He's not a reference on programming language design, and it shows. Compare to Leslie Lamport for instance, and the tremendous effect he had on large scale systems and software engineering correctness.

Can you argue your case as well as he does? https://www.youtube.com/watch?v=cQ7STILAS0M Or are you just being disrespectful?

I read the slides, but didn't hear the talk. There is so much conjecture in them. C++ is successful, Java is successful, so are Python, C#, and a whole bunch of other languages.

When it comes to complexity, large systems tend to be complex, so you either push some of that complexity into your language, to give you expressiveness and modeling capability, or you simplify your language so much (golang) such that the code base becomes complex and verbose due to repetition, not to mention error prone.

Readability? Compare:

    var a int
    if foo() {
      a = bar()
    } else {
      a = baz()
    }
to

    final int a = foo() ? bar() : baz()
or even

    val a = if foo() { bar() } else { baz() }
the latter two are shorter by a factor of 6, clearer, and less error prone. This is a feature that both improves readability, and reduces complexity.

The funny thing is, the golang code bases I worked with would be quite a bit shorter in a supposedly verbose language like Java, not to mention something like Kotlin.

Do you want a practical reason why golang is popular? Because it has Google behind its name. The language that he worked on before he was at Google, which were similar to golang, went nowhere.

Re: Generics aren't ready for Go

#235
post #234

Earlier quoted context omitted.

Can you argue your case as well as he does? https://www.youtube.com/watch?v=cQ7STILAS0M Or are you just being disrespectful?

I read the slides, but didn't hear the talk. There is so much conjecture in them. C++ is successful, Java is successful, so are Python, C#, and a whole bunch of other languages. When it comes to complexity, large systems tend to be complex, so you either push some of that complexity into your language, to give you expressiveness and modeling capability, or you simplify your language so much (golang) such that the cod…

There's a name for what you're doing. It's called "cherry picking". And also there's a name for the act of pulling something out of context to support an arbitrary point.

Let it be said that I'm not actually a Go but a C programmer, and there might be about 1 legitimate use of this syntactic construct per few thousand lines in my code (you are free to checkout my language project from github and verify my claim). It's not that I don't know the construct, but more that most experiments with it end up being reverted again to the longer form, to preserve the rhyme and rhythm of my code.

I won't take sides, but I guess their idea was that like so many other features, this little syntactic sugar construct does not carry its own weight.

> I read the slides, but didn't hear the talk

You absolutely should hear it! The slides probably do not contain actual experience reports, opinions, and arguments.

> the golang code bases I worked with would be quite a bit shorter in a supposedly verbose language like Java

that's hard to believe. Any code samples for illustration? (I invite you to cherry pick!).

Re: Generics aren't ready for Go

#236
Go programming language is designed for developers with mediocre level of intelligence!

The original language authors talk about that all the time, but nobody listens.

If you bring Generics to Go, most Go developers will be forced to switch to another simplistic programming language, like Basic.

[https://i.imgur.com/Y39gsPI.png]

Re: Generics aren't ready for Go

#237
post #234

Earlier quoted context omitted.

I read the slides, but didn't hear the talk. There is so much conjecture in them. C++ is successful, Java is successful, so are Python, C#, and a whole bunch of other languages. When it comes to complexity, large systems tend to be complex, so you either push some of that complexity into your language, to give you expressiveness and modeling capability, or you simplify your language so much (golang) such that the cod…

There's a name for what you're doing. It's called "cherry picking". And also there's a name for the act of pulling something out of context to support an arbitrary point. Let it be said that I'm not actually a Go but a C programmer, and there might be about 1 legitimate use of this syntactic construct per few thousand lines in my code (you are free to checkout my language project from github and verify my claim). It'…

> There's a name for what you're doing. It's called "cherry picking". And also there's a name for the act of pulling something out of context to support an arbitrary point.

There's also something called "argument from fallacy". Either refute the points I raised, otherwise there's no point bringing up fallacies :)

> Let it be said that I'm not actually a Go but a C programmer,

I have been using golang at my current employer for several months now. That being said, that's your experience, and it doesn't necessarily mean that everyone else has your use case.

The shorter form is (1) more readable, and (2) less error prone - fact. Less code also means less room to make errors. It was pretty laughable on the golang mailing list when someone asked why there wasn't a max/min implementation for all number types in golang, someone replied why do you need it? You can just implement it yourself like so, and proceeded to write a max implementation where the comparison operator was flipped. It's quite ironic really.

> but I guess their idea was that like so many other features, this little syntactic sugar construct does not carry its own weight.

It does, it reduces the probability of error by making sure that assignment happens only once. They weigh things very arbitrarily, like how one of the golang authors doesn't think compile checked enums are worth it because hey, they're just enums checked by the compiler to ensure coverage. It shows they don't have experience with other languages, or with features that reduce error rates.

> that's hard to believe. Any code samples for illustration? (I invite you to cherry pick!).

I already listed the lack of a ternary operator or its equivalent, and this extends to other constructs which can be expressions. Java is getting switch expressions in the upcoming release, and in Kotlin, try/catch is an expression, it's quite nice. The most obvious other one is error handling, "if err != nil" checks everywhere, which makes the code base much longer.

Others include the lack of map/fold/etc functions. The code base I work with is littered all over the place with functions to do what effectively are maps or maps+filters. Those functions end up being 8 lines or so, whereas they could be fit in 1-2 lines, inline at the call site, without the reader having to jump to the function implementation. This gets tiring very quickly, and makes it take longer to understand the code at hand.

Another example is needing to explicitly assign to a temporary variable if you need to take its address to pass it as an argument.

    a := foo()
    b := bar()
    c := baz()
    qux(&a, &b, &c)
as opposed to for example Rust:

    qux(&foo(), &bar(), &baz());
or Java

    qux(foo(), bar(), baz());

Re: Generics aren't ready for Go

#238
post #213
post #206

Earlier quoted context omitted.

Too bad they were removed. I don't see why a non-system language should use anything other than green threads nowadays.

Because Java also runs bare metal and in those scenarios, it is indeed a systems language. The HN community is too focused on OpenJDK/Oracle when talking about Java, when there are as several JDKs toolchains across the industry, some with very specialized deployment scenarios.

The lesson from that being, the extreme of "write once run anywhere" is not necessarily a good idea. Sometimes its best to implement specialized libraries and runtime (green threads) for specialized environments (servers) that are not available in others.
Post reply on HN