kardianos 1 hour 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.

  • dude250711 1 hour ago

    Gophers are usually quite fast, perhaps an elderly turtle would be a better mascot?

    • rob74 1 hour ago

      In day-to-day usage, the (fast) compilation speed matters much more than the (slow) implementation of new features.

      • christophilus 58 minutes 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.

        • aktau 47 minutes ago

          Spot on. Heaven forbid it turns into a C++ (I'm not a Rust practitioner but from the outside it seems to accrete features pretty quickly as well).

          The ease of grokking Go (both reading and writing) are big advantages, and facilitated by the "small" feature set of Go.

h1fra 2 hours ago

slowly implementing all the things they said we didn't need

  • TheChaplain 2 hours ago

    It's not a bad thing to realize that one can be wrong and then strive for change.

    • a-french-anon 2 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.

      • ramon156 2 hours ago

        So which language had it right from the start? is there a language that has a very low rewrite status?

        • bbkane 1 hour ago

          I'd particularly like examples of statically typed languages that "got it right" (since I love me my types)

          • galangalalgol 1 hour ago

            Ocaml maybe? Multi threading didn't seem necessary and introduced the possibility of data races.

        • maccard 1 hour ago

          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

          • blanched 43 minutes ago

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

      • ndr 2 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.

      • bbkane 1 hour 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.

      • xscott 1 hour 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 it's best to make every other lisp more attractive.

        • rootnod3 1 hour ago

          Which Scheme are we talking about? R5RS? R7RS-small? R6RS? With SRFIs? Without? Which scheme? Is it `(library...)` or `(define-module...)`?

          • xscott 1 hour ago

            Heh, I'd probably take R4RS with define-syntax :-)

        • rahen 13 minutes ago

          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.

      • rootnod3 1 hour 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.

      • boxed 1 hour 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.

      • iosjunkie 7 minutes ago

        "properly designed" - ah yes, programming languages are famous for universally agreed upon design philosophies.

    • tux3 2 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.

      • galangalalgol 1 hour 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.

    • maccard 1 hour 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.

      • Jleagle 1 hour 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.

        • maccard 1 hour ago

          I wanted it 10 years ago.

      • whoiskevin 1 hour ago

        Declaring a highly successful language as having the basics wrong means that you are not correct about the basics that were needed.

        • 9rx 1 hour ago

          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.

        • jeswin 1 hour ago

          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.

          • amazingamazing 1 hour ago

            This logic is easily shown to not hold. Why isn't Carbon, Dart, etc. not really popular then?

            • voidfunc 59 minutes ago

              Its just bitter dorks bitter their pet language with cutting edge programming abstractions didnt make it to the big leagues.

        • maccard 1 hour ago

          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.

          • 9rx 1 hour ago

            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.

            • jolux 53 minutes ago

              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.

              • 9rx 50 minutes ago

                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.

            • maccard 51 minutes ago

              > 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

        • boxed 1 hour ago

          The basics of a programming language were wrong. The basics of marketing were very right. Those are not the same.

        • n6242 58 minutes ago

          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.

          • hocuspocus 53 minutes ago

            And Javascript and Python the best languages.

        • OtomotO 58 minutes ago

          cough JavaScript cough

    • layer8 1 hour 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.

  • 9rx 1 hour 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.

  • CamouflagedKiwi 1 hour 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).

  • Cthulhu_ 11 minutes 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.

nasretdinov 1 hour 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

  • ncruces 24 minutes 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.

samber 44 minutes ago

OMG. I'm going to recode some of my libraries.

reactordev 1 hour 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.

binary132 1 hour 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.