<story><title>Notes on the Go2 Generics Draft</title><url>http://jmoiron.net/blog/notes-on-the-go2-generics-draft/</url></story><parent_chain></parent_chain><comment><author>nemo1618</author><text>I&amp;#x27;m glad I&amp;#x27;m not the only one sad to see generics invading a perfectly good language.&lt;p&gt;Programmers love generics because they enable higher-order abstractions, and programmers love abstractions -- code that isn&amp;#x27;t DRY is like an itch we need to scratch. Programmers also hate special cases, because they feel restrictive and inconsistent: I recall quite a few people protesting that Go&amp;#x27;s &amp;#x27;range&amp;#x27; keyword shouldn&amp;#x27;t be restricted to a handful of built-in types, but rather should support any type implementing an Iterator interface.&lt;p&gt;But Go was not designed to be perfectly consistent or to enable high-order abstractions. It just aims to be productive at scale, and that often means restricting the programmer. Go tries to be &lt;i&gt;non-magical&lt;/i&gt;, and sadly that can take much of the whimsy out of programming. You can&amp;#x27;t chain together operators in point-free style, or add a property to every &amp;#x27;Object&amp;#x27;, or directly increment a string, or anything like that. In other words, it&amp;#x27;s a terrible language for code golfing. But that sort of code has no place in a production environment anyway. It&amp;#x27;s &amp;quot;clever&amp;quot; code that gives the programmer a little dopamine hit when he writes it, and his co-workers a headache three months later. Those are misaligned incentives.&lt;p&gt;So I worry about generics because they let you abstract with wild abandon. They let you inject a little magic. And I fear that programmers will be seduced by their love of magic, and I&amp;#x27;ll be the one who ends up paying the price.</text></comment>
<story><title>Notes on the Go2 Generics Draft</title><url>http://jmoiron.net/blog/notes-on-the-go2-generics-draft/</url></story><parent_chain></parent_chain><comment><author>hugofirth</author><text>The author makes some interesting arguments, but they are all predicated on the idea that generics are somehow hard to grok or use?&lt;p&gt;Having helped teach Java to many people with less than a year&amp;#x27;s programming experience at university, I refute this.&lt;p&gt;Bear in mind we&amp;#x27;re hardly talking about higher kinded types here. Generics are a simple abstraction over a lack of type information which allows you to write and maintain a lot less code; something which has been repeatedly demonstrated to reduce the incidence of bugs.&lt;p&gt;Personally, I am encouraged that the Go team is flexible enough to change their position. That gives me more confidence in the future of the language, not less.</text></comment>