6 ms·
>When asked what changes would most improve Go, users most commonly mentioned generics, package versioning, and dependency management. and: >What changes woul
by coldtea 10y ago
>When asked what changes would most improve Go, users most commonly mentioned generics, package versioning, and dependency management.
and:
>What changes would improve Go most? (first: Generics)
Number one issue mentioned.
So much for all those insisting that Go users have no issues with the missing Generics and don't miss/need them in practice.
- bla2 10y agoBut, also, number one liked issue: simplicity. The go team doesn't say they don't want generics, they say they haven't found a non-complicated way to implement generics.
- coldtea 10y agoWell, I don't think there's some magic way. There are just the N ways PL research has found for implementing generics. Either they implement them, and tackle the complication one of those N ways entails, or they don't. Besides, has anyone seen much experiments, with actual coding or at least design, for finding this "non-complicated" way anyway? Not just some post once in a blue moon re-iterating the basic well known tradeoffs.
- gribbly 10y ago>Besides, has anyone seen much experiments, with actual coding or at least design, for finding this "non-complicated" way anyway? Proposal from Ian Lance Taylor, Go developer at Google https://github.com/golang/proposal/blob/master/design/15292-generics.md https://github.com/golang/proposal/blob/master/design/15292-... View of Russ Cox, Go developer at Google https://research.swtch.com/go2017#generics https://research.swtch.com/go2017#generics
- coldtea 10y agoYeah, I've read both -- and more. None of this is what I described: either actual code, even if in some experimental compiler branch/fork, or at least a concrete design. Ian's just reiterates the various options (Rob Pike has already written similar things), and Russ Cox is just several vague ideas for future additions to the language.
- deleted 10y ago[deleted]
- crypto5 10y agoSo, Russ says it is Ok to have generics but there are higher priorities. The problem with this approach is that eventually when they will add generics, there will be whole ecosystem living without them, which means this ecosystem will need to be entirely reimplemented.
- gribbly 10y agoWhy ? It's not as if the old code needs to be rewitten just because there is the option of generics.
- norswap 10y agoAdd invariant-only generic types (no subtyping relations between types with different type parameters) as a way to avoid 90% of casts. It doesn't get easier than this. As for going further, I think covariance and contravariance, while conceptually simple, will always be too complicated to wrap your head around. I think the future is invariant types + advanced generics functions. But research hasn't explored that direction yet. I might want to do that in the future. If it's relevant to anyone's interest, feel free to contact me.
- MichaelGG 10y agoYet millions of VB and C# users deal with them every day and seem to be doing fine. For a concept that's so old, it seems unlikely they're going to find some breakthrough either in implementation or language-simplicity.
- geodel 10y ago16% want generics and 17% love simplicity. So much for all those who claim generics remain overwhelming concern for Go developers.
- k__ 10y agoWhy not fork?
- geodel 10y agoyes, why not?
- monsieurbanana 10y agoYou really think a fork will help here? Can you explain a bit more how do you think a fork will work out?
- k__ 10y agoSo one side has its Go with generics and one without and in the end we would see which would do better?
- tapirl 10y agowhy not both?
- rdtsc 10y agoGo++ should at least be an April 1st thing, since it is coming up.
- josefx 10y agoIt should add everything C++ has or would that go2far ?
- pjmlp 10y agoBecause everyone of us that cares about generics uses languages that support them, and most likely a Go++ effort would be in vain, after all there are already a few Go preprocessors, which don't seem to be widely adopted.
- gpderetta 10y agoI'm not a Go programmer as I like my languages baroque, overcomplicated and with ridiculously overpowered generic systems [1], but there value in simplicity and maybe a macro system would be a better fit for go than fully featured generics. [1] yes, I'm a C++ programmer
- camus2 10y ago> yes, I'm a C++ programmer If you are a C++ programmer then you know that the latest features that were added aim at making C++ programming simpler and easier. Adding something to a language to fix its flaws is not necessarily adding some complexity.
- gpderetta 10y agoSure, but the C++ design philosophy is to be the Swiss army chainsaw: it offers tools (often dangerous) for every need. Go is designed to be a much simpler tool, with the spirit that constraints are liberating. A simple macro system would maybe fit better the second philosophy than a significantly more complex type system.
- pjmlp 10y agoThat they already have in the form of Go generate, although it brings me memories from MS-DOS Borland C++ before they implemented templates and used preprocessor macros.
- prodigal_erik 10y agoReading and writing CPP macros is awful, but it's still not as bad as reading and writing the mind-numbing boilerplate that they replace.
- gpderetta 10y agoA quick look shows that 'go generate' simply allows filtering a file through an external tool. This is a powerful feature but has great setup overhead. Something slightly more integrated with the language (as a distinct compiler pass but still part of the language), with the capability of defining macros inline (and being exportable), and AST based instead of string based would be better.
- lopatin 10y agoCoding without generics turns out to have many advantages. Mostly code bases that need to evolve rapidly without getting locked in to abstractions that don't fit anymore. It certainly is a mindset shift, and may be better at scale, but it's also more tedious and sometimes you just want a freaking Foo<Bar>.
- coldtea 10y ago>Coding without generics turns out to have many advantages. Mostly code bases that need to evolve rapidly without getting locked in to abstractions that don't fit anymore. How would Generics restrict you any more than the numerous variations on the same functions for different types (that you need today)? Except if the alternative is using interface{} for everything, in which case, yes, Generics would be more restrictive.
- charlieflowers 10y agoI don't really see that. How does coding IntList and then StringList help you evolve more freely than List<Int> and List<String>? (Honest question ... I'm interested to hear what you have in mind.)
- camus2 10y agoGenerics would make go code safer, less reliant on complicated tricks to circumvent language limitations and the need for reflection and ultimately make programs less brittle since it would reduce the amount of code needed for a task in general. The only valid argument against them is compilation speed but it hasn't been tried in real.
- stymaar 10y agoEven the compilation speed is not a problem related to generics themself, it's a problem related to monomorphisation. If you keep dynamic dispatch, you pay almost no compilation penalty.
- gtrubetskoy 10y agoFWIW, generics were added to Java in 2004, about 9 years after initial release. ref: https://en.wikipedia.org/wiki/Generics_in_Java https://en.wikipedia.org/wiki/Generics_in_Java
- vvanders 10y agoSince they were tacked on they also have all sorts of issues like type erasure and the like that make them a pain to use in certain cases.
- whatever_dude 10y agoAnd one could say it was too early. Under the hood, generics are pretty bad in Java [0]. Type information is mostly lost; it's a compiler time only feature. They're much better implemented in C#, even if they look the same on the surface, probably because it came later and they took it seriously. So I applaud the Go architects with being conservative about it. More languages should take their time thinking about implementing features, no matter how needed they seem to be initially. You only get one chance, and then if it's a bad choice you live with the consequences. [0] http://www.jprl.com/Blog/archive/development/2007/Aug-31.html http://www.jprl.com/Blog/archive/development/2007/Aug-31.htm...
- tonyedgecombe 10y agoIt doesn't appear we are waiting longer to get a better solution, rather we appear to be waiting and getting no solution.
- rsc 10y agoTelling those two apart reliably is one of the fundamental problems in computer science.
- sreque 10y agoJust about every programming language expert I've seen who's talked about Java generics says Java did a better job than C#. In fact, of all language runtimes that do generics, the .NET runtime is the only one that specializes. Examples of runtimes that do not specialize or reify generics: * JVM * Haskell runtime * ML family of languages * Modula-3 * Ada The problem with specialized generics in the runtime is that they bake the type system of the language into the runtime itself, making the runtime more difficult to work with. Type erasure, for instance, makes it much easier to implement alternative languages on the JVM such as JRuby, Clojure, Scala, or Kotlin, than on .NET. As another example, C# in 4.0 added the concept of generic type variance, which is completely at odds with specialized generics. To implement this feature, the C# language designers had to modify the underlying runtime itself and add special bytecode instructions for the feature. The feature itself is also incompatible with specialized generics, so when you use it you silently lose specialization. In contrast, thanks to type erasure, the Scala language designers could easily add the same feature on top of the JVM as-is without needing Oracle to add special bytecode instructions. Specialization has advantages for performance when doing number crunching with data structures and algorithms operating directly on integral or floating point data types. At the end of the day, though, if you really need performance for this very narrow field of use cases, you're probably not going to be using generic data structures and algorithms anyways. It takes an incredible amount of effort to build a data structure or algorithm that is both generic and also performant in all possible usage scenarios. It is however, much easier to build a data structure or algorithm that is specific and performant relative to your use case alone. Case in point: when I was in college doing a NLP assignment that needed to be fast, my data structures were arrays of doubles because that was the easiest way to reason about and ensure performance.
- out_of_protocol 10y agoNot really the first. generics = 16% management+dependency+package+dependency management = 38% (what a crappy survey. I'm not sure is it even possible to just sum these)
- camus2 10y agogeneric = 1% generics = 16% so it's a good chunk of the people who answered the survey. 2% mention types and 1% type system so it might be possible these come from people dissatisfied with the type system. Finally, it's not clear whether people who mentioned dependency management where also counted in dependency and management. All we know is that "generics" was the word the came out the most often.
- falcolas 10y agoThe interpretation of the open questions could definitely use some semantic analysis; I agree that it really does look like there's more frustration around packaging than generics, based on how they interpreted the results.
- rsc 10y agoIt's not possible to sum them. See the explanation of how to read the data under the "What do you like about Go?" results. In particular, "management" and "dependency" both include the "dependency management" counts, so including those in the sum double-counts responses that say "dependency management". I ran the numbers just now, and 571 responses contain the (case-insensitive) text substring "package manage" or "dependenc", compared to 623 for substring "generic". These two topics are very clearly the top two. They're also both on my list for this year (research.swtch.com/go2017). It doesn't seem that important which one "won". If you have suggestions for how to summarize free-response text in a way that lets the data speak rather than lend itself to cherry-picking, please let us know. I'm certainly open to improved analysis next time.
- Zikes 10y agoI'm a Go user, both at work and at home. My most-wanted feature is Generics, but I trust the Go core team when they say they want to ensure the feature is implemented correctly. The absolute last thing I want is for them to rush some half-assed implementation, which becomes semi-permanent because they can't fix it without breaking everyone's code.
- deleted 10y ago[deleted]
- zeveb 10y agoWhat I think is a bit remarkable is that it's not so much generics which are lacking, but syntactic abstraction. Folks focus on generics, but really the one thing Go is missing is the ability to extend the language as a programmer.