Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

49% Positive

Analyzed from 4166 words in the discussion.

Trending Topics

#generics#language#generic#methods#types#don#need#design#always#add

Discussion (216 Comments)Read Original on HackerNews

thayneabout 10 hours ago
> Go doesn't support such generic interface methods because we don't know how to implement (calls of) them, or at least we don't know how to implement them efficiently.

I don't really understand this argument. I read the discussion linked to[1], and yeah, monomorphization approaches (whether at compile time, link time, or runtime with JIT) are obviously going to be difficult or impossible, but the reason against using runtime reflection is mostly that it's slow. But that runtime reflection is exactly how you would work around it today.

For the Identity example, could the interface be compiled to be basically equivalent to:

Identity(any) any

and then at the callsite add a cast of the return type to T?

I suppose primative non-pointer types add a bit of a wrinkle but even if it generic methods was restricted to pointer types, that's better than nothing. And the number of those types is relatively small, so when the implementation is compiled it could just instantiate method implementations for all the primative types, if they apply, and then maybe remove them if they aren't needed at link time.

Of course it's also possible there is some detail I've missed.

[1]: https://go.googlesource.com/proposal/+/refs/heads/master/des...

Meroviusabout 5 hours ago
> but the reason against using runtime reflection is mostly that it's slow.

More specifically, it is that it would introduce surprising performance cliffs – code becoming surprisingly slow due to seemingly unrelated changes.

Though BTQH I think an even more important argument is that you would need to have effectively two generics implementations, one working at runtime and one working at compile time. That's a lot of complexity, with surprising failure modes if these two are not bug-compatible.

> But that runtime reflection is exactly how you would work around it today.

I think the overwhelming majority of people will "work around it" by just not trying to use generic methods.

thayneabout 3 hours ago
> you would need to have effectively two generics implementations, one working at runtime and one working at compile time

My understanding is that go already has a hybrid system works at compiletime and sometimes at runtime.

Meroviusabout 1 hour ago
I'm not sure what you mean. Perhaps you are referring to the reflect package? In that case, yes, that exists. But it is limited in its power (for example, it doesn't allow to create types with methods – precisely because of the difficulties we are talking about) and a comparatively frequent source of bugs. If anything, it provides pretty strong evidence for the problems with this approach.
whaleofatw2022about 8 hours ago
> Of course it's also possible there is some detail I've missed.

Can't speak too deeply for Go specifically, but I do know on .NET one of the big reasons generic methods where T is a structure gets monomorphized per type, is so that stack size is adjusted and potentially even arg passing (i.e. large struct) as far as the caller/callee.

MrBuddyCasinoabout 5 hours ago
Like Java‘s generic erasure? Primitive types aren’t supported at all, have to used boxed ones. Its slightly annoying but not too much. You can fall back to arrays to have performant primitive containers.
pjmlpabout 6 hours ago
Go becoming a proper 21st century language, is like pulling teeth.

It is Apple's school of design, think different, ah, actually, there are reasons why the fence is in the middle of nowhere.

Then the design ends up half way there versus being done properly from the beginning.

piekvorstabout 4 hours ago
“Done properly from the beginning” means explaining why a particular feature is either included or not. In this sense, Go is done properly from the beginning. It would be wrong to add every popular feature uncritically.
pjmlpabout 4 hours ago
"They are likely the two most difficult parts of any design for parametric polymorphism. In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier."

Yeah very critically.

piekvorstabout 4 hours ago
You can’t be omniscient, I think.
xenaabout 18 hours ago
This will finally let me make the monad library I've been dreaming of for years. Be afraid.
bonesssabout 17 hours ago
A monad library in go can really on have one name… …
oh_fiddlesticksabout 16 hours ago
Go nad or go home
digitaltreesabout 8 hours ago
Underrated
henniluabout 4 hours ago
GoMad
whaleofatw2022about 8 hours ago
Strife
uproarchatabout 4 hours ago
Weeee
zephenabout 12 hours ago
Mo-go?
throwaway894345about 12 hours ago
Mongo
nasretdinovabout 17 hours ago
We already have monads at home (return X, err)
assbuttbuttassabout 11 hours ago
It's (sadly) still not possible to express monads with this change, since generic methods can't implement interfaces. You'd probably want something like:

    type Monad[T any] interface {
        Bind[U any](func(T) Monad[U])
    }
However this requires the Bind method to be generic, which still isn't allowed in an interface
_jackdk_about 9 hours ago
I am not very familiar with Go and especially not its generics support. Can you implement the "join" version instead of the "bind" version, where you turn a T[T[a]] into a T[a]?
dnnddidiejabout 12 hours ago
Can we have Exception monads? Asking for friend.
AdieuToLogicabout 6 hours ago
> Can we have Exception monads? Asking for friend.

This is nonsensical. Monads define a strict set of behaviors formalized as "monad laws"[0].

Perhaps what you want is a container which adheres to monad laws capable of abstracting exceptions. Two exemplars of same are Haskell's Data.Either[1] and Scala's Either[2].

0 - https://wiki.haskell.org/Monad_laws

1 - https://hackage-content.haskell.org/package/base-4.22.0.0/do...

2 - https://www.scala-lang.org/api/3.8.3/scala/util/Either.html

dnnddidiejabout 1 hour ago
> Perhaps what you want is a container which adheres to monad laws capable of abstracting exceptions

That is what I meant. Struggling to picture what the other "nonsensical" thing is.

lackerabout 6 hours ago
I don't think it's nonsensical, it's just another name for the same thing. E.g. in the Haskell wiki it says, "the Error monad, also called the Exception monad".

https://wiki.haskell.org/index.php?title=All_About_Monads

9rxabout 7 hours ago
Funnily enough, Go's generics were designed by the same guy who introduced monads to computer science. Everything comes fill circle.
AdieuToLogicabout 6 hours ago
> Funnily enough, Go's generics were designed by the same guy who introduced monads to computer science.

No contributor to Go is responsible for "introducing monads to computer science", as the Monad concept is a member of (or defined by if you prefer) Category Theory[0].

0 - https://en.wikipedia.org/wiki/Category_theory

rustyzigabout 6 hours ago
As you point out, monads come from category theory, not native to computer science. Thus there had to be someone to introduce approaches to applying monads in computer science. The paper usually credited with that is: https://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/b... Which the parent rightfully points out was written by the same person primarily responsible for the design of generics in Go: https://homepages.inf.ed.ac.uk/wadler/topics/go.html
klik99about 1 hour ago
I remember lack of generics being pitched as a feature of Go initially, not a lack. The original design goal was simplicity. I don’t use Go, so have no opinion on this, just interesting that it’s going in this direction.
nasretdinovabout 22 hours ago
Lack of generic methods was really surprising to me when I was first trying to use generics in Go. Nice to see it being actually implemented
ncrucesabout 21 hours ago
To be replaced by the surprise when you figure out these methods don't implement interfaces.

Still, in this case, half the feature is better than none at all, IMO.

nasretdinovabout 20 hours ago
Generic interfaces are going to be implemented later too if I'm reading correctly. So no real surprises there :). I guess the only surprise yet is that generic interfaces aren't supported, so generic methods physically can't satisfy any interface
kbolinoabout 14 hours ago
Generic interfaces already exist. Generic interface methods, which would be relevant, are not planned. The reason is outlined early in the proposal: nobody knows how to implement them efficiently. Rust has the same problem, for what it's worth: dispatchable functions on dyn-compatible traits cannot be generic [1].

[1]: https://doc.rust-lang.org/reference/items/traits.html#r-item...

ncrucesabout 17 hours ago
I didn't see anything beyond "this doesn't prevent us from doing it" yet.

Did you?

h1fraabout 23 hours ago
slowly implementing all the things they said we didn't need
zarzavatabout 10 hours ago
Watching Go's development is like reliving the development of Java (which also didn't have generics at first), but over decades instead of years. Cannot wait for Go to implement an error handling system in the 2030s.
20kabout 8 hours ago
Its very funny watching certain segments of the programming industry rediscovering incredibly basic programming principles, after railing against them for so long. The AI people are starting to try and create formal specs to force the AI to generate an exact output, which is absolutely hilarious to me

Dynamically typed/untyped languages finding that strict and visible typing is actually good is another

jimbokunabout 7 hours ago
I feel like there was a name for formal specs that produce an exact output, but it escapes me…
pjmlpabout 5 hours ago
Another one, WebAssembly people recreating application servers, and networking object models.
pjmlpabout 5 hours ago
Thankfully we already have Java, so using Go is really for the scenarios where it cannot be avoided.
CamouflagedKiwiabout 22 hours ago
They didn't say they never wanted to do generics, but that they did want to take their time and do them right.

Debatable how much they have been "right", although this gets them somewhat closer. And I think they have not been "wrong" in the ways they wanted to avoid (they referenced some issues with Java generics as prior art, although I forget the details).

tinesabout 20 hours ago
From another commenter here:

> The post quotes the Go FAQ as saying, "we do not anticipate that Go will ever add generic methods".

jimbokunabout 7 hours ago
> “What do you think? There was a man who had two sons. He went to the first and said, ‘Son, go and work today in the vineyard.’ “ ‘I will not,’ he answered, but later he changed his mind and went. “Then the father went to the other son and said the same thing. He answered, ‘I will, sir,’ but he did not go. “Which of the two did what his father wanted?” “The first,” they answered. Jesus said to them, “Truly I tell you, the tax collectors and the prostitutes and the Go language maintainers are entering the kingdom of God ahead of you.

https://www.bible.com/bible/compare/MAT.21.28-31

foldrabout 2 hours ago
But they haven’t added generic methods, really. This change just lets you use method syntax in cases where you could have used a function. It’s a pretty conservative change that I think a lot of people here are misunderstanding. Actual generic methods wouldn’t really make sense (for the same reason that you have similar restrictions on dynamic trait implementations in Rust).
skywhopperabout 19 hours ago
Is anyone actually mad about this, or do people just bring it up to stir the pot? Who cares what the FAQ says? They've worked out a way to add it easily in a backwards compatible way that can solve some problems. They had not identified this solution at the time they wrote the FAQ, and Go has been perfectly usable without this feature for 16 years.
thayneabout 17 hours ago
Depends you who "they" is. If you mean the go development team, then yes, they said they wanted to "take their time and do them right"¹. But there are many "gophers" who did say that there was no need for generics, and that it shouldn't be added to the language.

¹ I would argue that it is really, really hard to add generics to a language after it has already matured, and still "do it right" than to add it in the beginning. At least if you care about backwards compatibility. Backwards compatibility adds a lot of constraints to your generics system that will almost certainly lead to a sub-optimal design. And you will be stuck with a standard library, and a lot of existing ecosystem code that would benefit from generics, but don't because generics didn't exist when they were written. This is a lesson I wish go had learned from Java's generics.

someone_19about 19 hours ago
I agree that they were clearly not in a hurry. I disagree that they are doing everything right. I am interested to see how they will fix the 'million dollars mistake'.
jimbokunabout 7 hours ago
Because they refuse to do something until they figure out how to do it well.

I respect that.

tapirlabout 7 hours ago
Go's generics design is the most clunky one among popular languages.
TheChaplainabout 23 hours ago
It's not a bad thing to realize that one can be wrong and then strive for change.
a-french-anonabout 22 hours ago
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.
bbkaneabout 22 hours ago
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.
xscottabout 22 hours ago
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.
pizza234about 20 hours ago
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.
ndrabout 22 hours ago
"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.

ramon156about 22 hours ago
So which language had it right from the start? is there a language that has a very low rewrite status?
rootnod3about 22 hours ago
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.
iosjunkieabout 20 hours ago
"properly designed" - ah yes, programming languages are famous for universally agreed upon design philosophies.
boxedabout 21 hours ago
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.

skywhopperabout 19 hours ago
You may be tired of languages evolving over time, but there is no other way to build a rich and useful language.
fhnabout 20 hours ago
so make your own and let's see how you do
maccardabout 22 hours ago
There’s a fine line between being willing to change your mind and getting the basics wrong. Go has repeatedly gotten the basics wrong.
whoiskevinabout 22 hours ago
Declaring a highly successful language as having the basics wrong means that you are not correct about the basics that were needed.
Jleagleabout 22 hours ago
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.
tux3about 22 hours ago
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.

galangalalgolabout 22 hours ago
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.
layer8about 22 hours ago
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.
someone_19about 19 hours ago
...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

ivanjermakovabout 13 hours ago
Worst thing a programming language can do is introduce core semantics changes after 1.0. See Python 2 -> 3 and Zig's *gates.
metaltyphoonabout 12 hours ago
Except Zig is not 1.0
9rxabout 22 hours ago
Of course, if you go back and watch the original Go announcement it said that it would need generics once they figured out how to do it. And when the first version of generics landed it was said that generic methods would be added later, once they figured out how to do it. So that isn't applicable here. The need was always recognized.
zarzavatabout 9 hours ago
If Go had just taken an off-the-shelf implementation of generics in 2009 then they could have spent the last 16 years deliberating over something useful, rather than attempting to reinvent programming language theory.

The impression I have always gotten from Go's designers is that they are rather arrogant and averse to the idea of using other people's work. They want to develop everything from first principles, but by so doing end up with poor reinventions of well-studied concepts.

9rxabout 8 hours ago
> and averse to the idea of using other people's work.

They did use someone else's work, though. If you recall, Philip Wadler (of Haskell fame) designed Go's generics.

> but by so doing end up with poor reinventions of well-studied concepts.

Which is funny as there is probably nobody on earth that would be more capable than Wadler to get the job done. His pedigree in that area of work is pretty astounding. If he couldn't do more than create a poor reinvention, what hope did the laymen working on the Go core team have?

Answer: They had no hope. It's not like they weren't trying. Ian Lance Taylor, for instance, is well known for beginning work on generics in Go before it was even first released to the public. He, among others, quite simply, were unable to figure it out.

Everything looks easy and straightforward when observed comfortably from an armchair, I suppose.

Cthulhu_about 20 hours ago
Where did "they" say "we" didn't need generics? That sounds like a bad faith / misinterpretation / straw man; as someone else pointed out, they postponed generics until they figured out the use cases and whatnot.

Remember that the generics implementations in other languages (like Java) take up half the spec + implementation - that's not something that Go wanted.

tinesabout 20 hours ago
From another commenter here:

> The post quotes the Go FAQ as saying, "we do not anticipate that Go will ever add generic methods".

entropeabout 19 hours ago
You keep posting that. Do you understand the difference between that and "we anticipate that Go will never add generic methods"? What they actually said shows epistemic humility and recognizes that they might change their mind.
MrBuddyCasinoabout 5 hours ago
What did they say about proper enums.
someone_19about 4 hours ago
You already have iota. Type safety is not needed by design:

> Go intentionally has a weak type system... Go in general encourages programming by writing code rather than programming by writing types...

https://github.com/golang/go/issues/29649#issuecomment-45482...

MrBuddyCasinoabout 4 hours ago
Theres a whole universe between proper enums and go becoming Ada. Same with null safety.
fhnabout 20 hours ago
complaining about things given to you for free
doodpantsabout 20 hours ago
I frankly don't buy into this trope that a lack of monetary cost should shield something from criticism. Anything created by humans for other humans, especially tools meant for getting work done, should certainly be open to evaluation/judgement/critcism, regardless of whether the creator chooses to charge for it.

And it's not like Golang is some freshman student's hobby project; it was created by one of the world's largest tech companies, by people with a strong pedigree in programming language design.

msaher66about 4 hours ago
Since they can't implement interfaces, Generic methods are just syntax sugar for generic functions. I'm surprised they actually accepted this proposal for sugar.
tapirlabout 3 hours ago
Yes, the sugar is just to make chain calls with parameter types possible. The sugar reflects the limitation of the basic of Go generics design. Now they would make the language even more complex for such a small need. In facts, there are more problems in Go generics need to be solved earlier than this: https://go101.org/generics/888-the-status-quo-of-go-custom-g...
kardianosabout 22 hours ago
This is great. Will be useful for data access methods!

As for the detractors, from the first generics proposal this was called out as a "not now", not never. There were questions of implementation. They aren't a super large team, and they try to do things incrementally and do them well.

tczMUFlmoNkabout 20 hours ago
> As for the detractors, from the first generics proposal this was called out as a "not now", not never.

What? The post quotes the Go FAQ as saying, "we do not anticipate that Go will ever add generic methods". There is also some similar discussion of the original generics proposal, with language like "then it's much less clear why we need methods at all". (I'm omitting some context, but I don't feel that it changes the meaning.) Those feel much closer to "never" than "not now".)

The post is also subtitled "A change of view".

stousetabout 19 hours ago
No, you’re clearly wrong; golang was always going to add support for generic functions.

Everyone also wanted and accepted the need for generics. It was always something they wanted to add to the language. Rob Pike never said that that kind of abstraction isn’t what golang is for. It was always just a matter of getting the design right.

Go has always been a systems language. It was one when we thought it was going to fit nicely for low-level, high performance use-cases. Given that the GC, runtime overhead, lack of control over memory layout, and other issues made it a poor fit for what we historically thought were systems language tasks, it’s still a systems language because we’ve grown to understand that the term “systems program” has always meant network middleware that shuttles around JSON and transforms it.

Dependency management too. Modules were something that nobody argued were unnecessary. None of the language developers ever claimed that “you should always build against HEAD, and if upstream breaks you, that’s a coordination problem to be solved socially”. The community didn’t need to independently invent godep, then glide, then govendor, then dep, before the core team finally shipped modules. That was just enthusiastic parallel exploration of a problem space that everyone agreed was a problem.

GOPATH was always understood to be an awkward temporary scaffold that everyone tolerated while the real solution was being designed. The single-workspace model was never defended as philosophically correct or a deliberate feature of the language. When modules arrived, everyone was simply relieved that this obvious stopgap was finally replaced.

The core team always intended to add builtins for min/max. Nobody ever told you to just write `if a > b { return a }; return b` yourself because it was “only two lines.” The fact that every Go codebase in existence had its own copy of this logic, typically buried in a file called util.go, was not evidence of anything being missing from the language.

Range was always a stopgap before iterators could be implemented. Nobody ever argued that iterators were needlessly complicated and went against the spirit of the language. The slices and maps packages provided important missing features that everyone using the language wanted.

Everyone agrees that errors were anemic from the outset. errors.Is/errors.As are nice additions but everything was Just Fine™ before they were added.

Speaking of errors, having two lines of error-handling boilerplate for every line of code is good, and right, and perfect. It’s not verbose; it’s “explicit”. But when that gets changed to be less verbose, we will all agree that it was always a pain and made reading code unnecessarily more difficult and that everyone always expected this to be fixed some day.

I personally can’t wait to see what next development will never have been “against the Go philosophy” and definitely not something that gophers argued was perfect the way it was any time misguided malcontents and rabble-rousers wrongly tried to suggest the language wasn’t perfect the way it was.

bborud19 minutes ago
You have those who obsess over feature lists for languages and then you have those who obsess over friction, productivity, ease of use and developer ergonomics.

If I were uncharitable I might call the categories "people who are somewhat removed from reality" and "people who inhabit observable reality". Avoid the former, treasure the latter.

Languages evolve for a reason and nobody should give a shit about people who do not understand why.

galkkabout 3 hours ago
I love your rant.

The writing is on the wall for next development.

“For the foreseeable future, the Go team will stop pursuing syntactic language changes for error handling. We will also close all open and incoming proposals that concern themselves primarily with the syntax of error handling, without further investigation.”

cypharabout 18 hours ago
> The community didn’t need to independently invent godep, then glide, then govendor, then dep, before the core team finally shipped modules. That was just enthusiastic parallel exploration of a problem space that everyone agreed was a problem. When modules arrived, everyone was simply relieved that this obvious stopgap was finally replaced.

And of course, it was replaced with a more correct implementation that was incompatible with that awful stopgap because semantic correctness trumps all. vendor/ trees and GOPATH were never meant to be remotely compatible, and don't you know -- the Go compatibility guarantee(TM) doesn't apply to misuse of GOPATH to work around shortcomings^Wwell-considered designs of Go, even if it breaks the largest Go project at the time!

(/s It still shocks me that they decided to drop "src" from vendor/src and break compatibility when they finally got around to supporting vendoring despite every tool using it. And symlinks don't work because Plan 9 is the future!!)

jpc0about 18 hours ago
> term “systems program” has always meant network middleware that shuttles around JSON and transforms it.

Who are we that has always defined that term that way. For any systems programmer golang has pretty much not been a solution.

Systems is below layer 4 of the network stack, it is building the network stack in the first place.

thayneabout 18 hours ago
> I personally can’t wait to see what next development will never have been “against the Go philosophy” and definitely not something that gophers argued was perfect the way it was any time misguided malcontents and rabble-rousers wrongly tried to suggest the language wasn’t perfect the way it was.

I really hope it is more ergonomic error handling. Or maybe sum types/discriminated unions.

someone_19about 4 hours ago
> No, you’re clearly wrong; golang was always going to add support for generic functions.

Let's get this straight. I'll give you a long quote from Rob Pike's article where he describes the history of the go language:

""" One thing that is conspicuously absent is of course a type hierarchy. Allow me to be rude about that for a minute.

Early in the rollout of Go I was told by someone that he could not imagine working in a language without generic types. As I have reported elsewhere, I found that an odd remark.

To be fair he was probably saying in his own way that he really liked what the STL does for him in C++. For the purpose of argument, though, let's take his claim at face value.

What it says is that he finds writing containers like lists of ints and maps of strings an unbearable burden. I find that an odd claim. I spend very little of my programming time struggling with those issues, even in languages without generic types.

But more important, what it says is that types are the way to lift that burden. Types. Not polymorphic functions or language primitives or helpers of other kinds, but types.

That's the detail that sticks with me.

Programmers who come to Go from C++ and Java miss the idea of programming with types, particularly inheritance and subclassing and all that. Perhaps I'm a philistine about types but I've never found that model particularly expressive.

My late friend Alain Fournier once told me that he considered the lowest form of academic work to be taxonomy. And you know what? Type hierarchies are just taxonomy. You need to decide what piece goes in what box, every type's parent, whether A inherits from B or B from A. Is a sortable array an array that sorts or a sorter represented by an array? If you believe that types address all design issues you must make that decision.

I believe that's a preposterous way to think about programming. What matters isn't the ancestor relations between things but what they can do for you.

That, of course, is where interfaces come into Go. But they're part of a bigger picture, the true Go philosophy. """

Rob Pike, 2012

I can draw a few conclusions from this: firstly, he didn't want to add generics at all because he didn't think they were useful, and secondly, he doesn't understand programming very well and doesn't know what generics are and confuses them with inheritance.

kardianosabout 20 hours ago
I could be mis-remembering it. I didn't look up and src it.
dude250711about 22 hours ago
Gophers are usually quite fast, perhaps an elderly turtle would be a better mascot?
rob74about 21 hours ago
In day-to-day usage, the (fast) compilation speed matters much more than the (slow) implementation of new features.
christophilusabout 21 hours ago
I totally agree, but I'd go further and argue that slow implementation of new features is itself a desirable trait. It's one of the reasons why why I like both Go and Clojure.
cookiengineerabout 19 hours ago
> Gophers are usually quite fast, perhaps an elderly turtle would be a better mascot?

The slow turtle wins the race against the overly eager rabbit... so I'm okay with that

ethinabout 5 hours ago
Watch as this gets rejected for nonsensical reasons just like the issue about adding uint128, which also has been open for an extremely long time and they keep moving the goalposts as to reasons why it can't be done...
piekvorstabout 4 hours ago
It’s accepted.
ethinabout 4 hours ago
Now there's a surprise. I've generally been very disillusioned with Go after they absolutely stonewalled everybody on uint128 (and continue to do so) for absolutely no reason (and ignoring that it would make many things in the language easier to express).
MrBuddyCasinoabout 4 hours ago
> it would make many things in the language easier to express

Like what?

reactordevabout 22 hours ago
This resolves a big gap in generics for most people coming from other languages to go so I completely approve this direction. Not saying use it everywhere but if you must use it, it’s better to have it on the struct than call a module level generic func.
mackrossabout 20 hours ago
What a happy surprise today! The amount of times I’ve had to do weird janky package APIs so the API was still reasonable is more than I can count.
Advertisement
samberabout 21 hours ago
OMG. I'm going to recode some of my libraries.
binary132about 21 hours ago
Chasing a perceived gap between language features and user expectations has been and continues to be the greatest error in the leadership of Go.
pizzafeelsrightabout 20 hours ago
The nagging imperative requires a stronger response than the capitulation of identity.
MrBuddyCasinoabout 3 hours ago
They should have blocked generics forever and instead have a proper enum. Unpopular opinion, I know.
p0w3n3dabout 5 hours ago
what's wrong with `#define`? <laughing hysterically>

nah I'm kidding

<after 55 seconds>

Seriously, what's wrong with `#define`?