8 comments

  • mackross6 minutes 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.
  • kardianos2 hours ago
    This is great. Will be useful for data access methods!<p>As for the detractors, from the first generics proposal this was called out as a &quot;not now&quot;, not never. There were questions of implementation. They aren&#x27;t a super large team, and they try to do things incrementally and do them well.
    • tczMUFlmoNk31 minutes ago
      &gt; As for the detractors, from the first generics proposal this was called out as a &quot;not now&quot;, not never.<p>What? The post quotes the Go FAQ as saying, &quot;we do not anticipate that Go will ever add generic methods&quot;. There is also some similar discussion of the original generics proposal, with language like &quot;then it&#x27;s much less clear why we need methods at all&quot;. (I&#x27;m omitting some context, but I don&#x27;t feel that it changes the meaning.) Those feel much closer to &quot;never&quot; than &quot;not now&quot;.)
      • kardianos16 minutes ago
        I could be mis-remembering it. I didn&#x27;t look up and src it.
    • dude2507111 hour ago
      Gophers are usually quite fast, perhaps an elderly turtle would be a better mascot?
      • rob741 hour ago
        In day-to-day usage, the (fast) compilation speed matters much more than the (slow) implementation of new features.
        • christophilus1 hour ago
          I totally agree, but I&#x27;d go further and argue that slow implementation of new features is itself a desirable trait. It&#x27;s one of the reasons why why I like both Go and Clojure.
          • aktau1 hour ago
            Spot on. Heaven forbid it turns into a C++ (I&#x27;m not a Rust practitioner but from the outside it seems to accrete features pretty quickly as well).<p>The ease of grokking Go (both reading and writing) are big advantages, and facilitated by the &quot;small&quot; feature set of Go.
  • nasretdinov2 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
    • ncruces53 minutes ago
      To be replaced by the surprise when you figure out these methods don&#x27;t implement interfaces.<p>Still, in this case, half the feature is better than none at all, IMO.
      • nasretdinov5 minutes ago
        Generic interfaces are going to be implemented later too if I&#x27;m reading correctly. So no real surprises there :). I guess the only surprise yet is that generic interfaces aren&#x27;t supported, so generic methods physically can&#x27;t satisfy any interface
  • h1fra2 hours ago
    slowly implementing all the things they said we didn&#x27;t need
    • CamouflagedKiwi1 hour ago
      They didn&#x27;t say they never wanted to do generics, but that they did want to take their time and do them right.<p>Debatable how much they have been &quot;right&quot;, although this gets them somewhat closer. And I think they have not been &quot;wrong&quot; in the ways they wanted to avoid (they referenced some issues with Java generics as prior art, although I forget the details).
      • tines9 minutes ago
        From another commenter here:<p>&gt; The post quotes the Go FAQ as saying, &quot;we do not anticipate that Go will ever add generic methods&quot;.
    • Cthulhu_40 minutes ago
      Where did &quot;they&quot; say &quot;we&quot; didn&#x27;t need generics? That sounds like a bad faith &#x2F; misinterpretation &#x2F; straw man; as someone else pointed out, they postponed generics until they figured out the use cases and whatnot.<p>Remember that the generics implementations in other languages (like Java) take up half the spec + implementation - that&#x27;s not something that Go wanted.
      • tines9 minutes ago
        From another commenter here:<p>&gt; The post quotes the Go FAQ as saying, &quot;we do not anticipate that Go will ever add generic methods&quot;.
    • TheChaplain2 hours ago
      It&#x27;s not a bad thing to realize that one can be wrong and then strive for change.
      • a-french-anon2 hours ago
        Maybe, but personally I&#x27;ve become quite tired of programming languages &quot;organically grown&quot; 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.
        • bbkane2 hours ago
          I know Go is justly criticized for many of its design decisions, but it still feels well-designed and &quot;small&quot; to me in day to day usage when many other languages don&#x27;t.
          • a-french-anon32 minutes ago
            Eh, the thing with generics coming late is pretty much what I meant by &quot;organically grown&quot;.<p>My best litmus test these days is support for multidimensional arrays because it&#x27;s always needed at some point in general purpose languages. CL and Ada had it right from the start while C++ needed C++23&#x2F;26 to get std::mdspan and we still need to wrap it to pass the underlying&#x2F;owned memory pool around (<a href="https:&#x2F;&#x2F;rosettacode.org&#x2F;wiki&#x2F;Multi-dimensional_array" rel="nofollow">https:&#x2F;&#x2F;rosettacode.org&#x2F;wiki&#x2F;Multi-dimensional_array</a> for more).
            • nish__3 minutes ago
              Doesn&#x27;t every language support multidimensional arrays? It&#x27;s just an array of arrays, no? What am I missing?
        • xscott2 hours ago
          Scheme is (or at least was) coherent. You don&#x27;t need to look any further than set&#x2F;setf&#x2F;setq to see that Common Lisp is &quot;organically grown&quot; from the fertilizer of a committee. CL does its best to make every other lisp more attractive.
          • rahen42 minutes ago
            Scheme has a coherent and minimalist design, but its ecosystem and abstraction facilities feel too sparse for large applications.<p>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.<p>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.
          • rootnod32 hours ago
            Which Scheme are we talking about? R5RS? R7RS-small? R6RS? With SRFIs? Without? Which scheme? Is it `(library...)` or `(define-module...)`?
            • xscott1 hour ago
              Heh, I&#x27;d probably take R4RS with define-syntax :-)
        • ndr2 hours ago
          &quot;Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.&quot;<p>-- Greenspun&#x27;s tenth rule<p>He had some lack of conviction to scope it so narrowly.
        • iosjunkie36 minutes ago
          &quot;properly designed&quot; - ah yes, programming languages are famous for universally agreed upon design philosophies.
        • ramon1562 hours ago
          So which language had it right from the start? is there a language that has a very low rewrite status?
          • poncho_romero17 minutes ago
            I think Elixir is a good candidate here. It&#x27;s small, coherent, and composes well, and (at least to my understanding) the authors consider the language finished, with no new major features planned.
          • bbkane2 hours ago
            I&#x27;d particularly like examples of statically typed languages that &quot;got it right&quot; (since I love me my types)
            • galangalalgol1 hour ago
              Ocaml maybe? Multi threading didn&#x27;t seem necessary and introduced the possibility of data races.
          • maccard2 hours 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.<p>As an aside - D, Zig, Rust, even typescript got most of the lessons learned from C right
            • Maxatar8 minutes ago
              D literally can&#x27;t even maintain backwards compatibility between minor version updates not to mention a big part of the D community left when D reinvented itself with D2. Among languages it&#x27;s probably the one that is constantly in a state of flux.
            • blanched1 hour ago
              I&#x27;m not familiar with D, but Zig and Rust are well-known for continuously evolving.<p>Zig has the (in)famous &quot;Writergate&quot;: <a href="https:&#x2F;&#x2F;github.com&#x2F;ziglang&#x2F;zig&#x2F;pull&#x2F;24329" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ziglang&#x2F;zig&#x2F;pull&#x2F;24329</a><p>And besides Rust&#x27;s high count of RFCs, there are things like async (I&#x27;m not complaining about it, but its an obvious large-scale &quot;change&quot;), module system changes, etc.<p>(To be clear, I like both languages a lot. But I wouldn&#x27;t call them slow moving or right from the start.)
        • rootnod32 hours ago
          ANSI CL is such a breath of fresh air nowadays. Does what you need, doesn&#x27;t get in your way, comes with batteries included. And conditions are just god-tier.
        • fhn15 minutes ago
          so make your own and let&#x27;s see how you do
        • boxed1 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.<p>Objective-C in contrast was a very few additions thoughtfully added that composed cleanly and freed the programmer to actually get things done.
      • maccard2 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.
        • whoiskevin2 hours ago
          Declaring a highly successful language as having the basics wrong means that you are not correct about the basics that were needed.
          • maccard1 hour ago
            Something can be highly succesful in spite of having glaring design flaws. Nobody is claiming go isn&#x27;t wildly succesful, but it&#x27;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&#x27;s mind on those things isn&#x27;t progress it&#x27;s just getting the fundamentals wrong.<p>A good example of where they&#x27;re kind of stuck is date formatting - it&#x27;s stupid, unclear, and likely a mistake, but it&#x27;s not a fundamental flaw; it&#x27;s just a quirk.
            • 9rx1 hour ago
              Why is iota a massive kneecap to the language? It is semantically identical to enum in C and Typescript.<p>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.<p>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&#x27;s more on the design quirk end, realistically.
              • maccard1 hour ago
                &gt; Why is iota a massive kneecap to the language? It is semantically identical to enum in C and Typescript.<p>iota is a massive kneecap _because_ it&#x27;s semantically identical to enum in C and Typescript.<p>&gt; 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&#x27;s more on the design quirk end, realistically.<p>In a dream world sure we&#x27;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&#x27;ve ran into when working with go), but I can forgive that. The problem is this - <a href="https:&#x2F;&#x2F;www.zarl.dev&#x2F;posts&#x2F;enums" rel="nofollow">https:&#x2F;&#x2F;www.zarl.dev&#x2F;posts&#x2F;enums</a>
              • jolux1 hour 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.
                • 9rx1 hour ago
                  The social landscape doesn&#x27;t depend on anyone actually using it. However, 1.0 isn&#x27;t a significant milestone like you suggest either. For a current example, Zig is relatively popular today despite not yet reaching 1.0.
          • n62421 hour 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.
            • hocuspocus1 hour ago
              And Javascript and Python the best languages.
          • jeswin1 hour ago
            It&#x27;s a highly successful language because (1) it was backed by Google, and (2) created by Robert Griesemer, Rob Pike, and Ken Thompson.<p>If it came out of anywhere else, it might have struggled even to hit the homepage here.
            • amazingamazing1 hour ago
              This logic is easily shown to not hold. Why isn&#x27;t Carbon, Dart, etc. not really popular then?
              • doodpants19 minutes ago
                I can&#x27;t speak about Dart, but Carbon had just barely started development when it was first announced 4 years ago, and is currently presented as an experimental language that is not yet ready for use [0].<p>0: <a href="https:&#x2F;&#x2F;github.com&#x2F;carbon-language&#x2F;carbon-lang#project-status" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;carbon-language&#x2F;carbon-lang#project-statu...</a>
              • voidfunc1 hour ago
                Its just bitter dorks bitter their pet language with cutting edge programming abstractions didnt make it to the big leagues.
          • boxed1 hour ago
            The basics <i>of a programming language</i> were wrong. The basics of marketing were very right. Those are not the same.
          • 9rx1 hour ago
            An engineer, of course, understands that there is no such thing as &quot;wrong&quot;, only different tradeoffs, but with the rise of &quot;vibe coding&quot; you don&#x27;t need to be an engineer to play in the world of programming anymore.
          • OtomotO1 hour ago
            <i>cough</i> JavaScript <i>cough</i>
        • Jleagle2 hours ago
          Sounds like you want this feature, and you just got it. Not sure how that&#x27;s wrong. You don&#x27;t add in every feature from the start.
          • maccard2 hours ago
            I wanted it 10 years ago.
      • tux32 hours ago
        I don&#x27;t think anyone admitted any wrong or had any big change in philosophy. It&#x27;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.<p>Of course adding generics is not something that every language needs to do. Scripting languages like Ruby don&#x27;t really need this style of generics. It doesn&#x27;t fit the design of the language, and it&#x27;s not even clear what that would look like in Ruby.<p>But static typing with generics does solve a recurring problem, and we&#x27;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&#x27;ve successfully retrofitted a very advanced type system in the last place I would have expected 20 years ago.
        • galangalalgol2 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&#x27;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&#x27;m just not capable of using them without making hideous mistakes.
      • layer81 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.
    • 9rx2 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&#x27;t applicable here. The need was always recognized.
    • fhn28 minutes ago
      complaining about things given to you for free
      • doodpants10 minutes ago
        I frankly don&#x27;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&#x2F;judgement&#x2F;critcism, regardless of whether the creator chooses to charge for it.<p>And it&#x27;s not like Golang is some freshman student&#x27;s hobby project; it was created by one of the world&#x27;s largest tech companies, by people with a strong pedigree in programming language design.
  • samber1 hour ago
    OMG. I&#x27;m going to recode some of my libraries.
  • reactordev1 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.
  • binary1321 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.
    • pizzafeelsright1 minute ago
      The nagging imperative requires a stronger response than the capitulation of identity.
  • throwpikerob1 hour ago
    A sad day for Go, the pHDs have won, simplicity has died.
    • valyala46 minutes ago
      Agreed 100%. <a href="https:&#x2F;&#x2F;itnext.io&#x2F;go-evolves-in-the-wrong-direction-7dfda8a1a620" rel="nofollow">https:&#x2F;&#x2F;itnext.io&#x2F;go-evolves-in-the-wrong-direction-7dfda8a1...</a>
    • Cthulhu_39 minutes ago
      It only died if you actually applied it in your own codebase - as with any feature, using it is optional.