News for hackers. Stuff that matters.
Re:Go 1.5 max procs default by zerr on Thursday May 28, 2015 @02:35PM (#9620155)
Any updates regarding generics and error handling?
Re:Go 1.5 max procs default by PopsiclePete on Thursday May 28, 2015 @03:11PM (#9620417)
Yep! Confirmed in Go 1.6. Also - algebraic data types, monads, operator overloading, actors, STM, multiple inheritance, exceptions, LINQ, full opt-in dynamic typing, optional GC! Anything you want! All language features, ever conceived, will be crammed into Go, starting with the next release!
Re:Go 1.5 max procs default by _ak on Thursday May 28, 2015 @05:52PM (#9621423)
I totally want my language to be a superset of C++, Scala, Haskell and APL.
Re:Go 1.5 max procs default by sirseal on Friday May 29, 2015 @02:25AM (#9623043)
You realize a Monad is a concept, not a language feature. One can implement a Monad in any language.
Re:Go 1.5 max procs default by artursapek on Thursday May 28, 2015 @03:19PM (#9620468)
No shit! I'm buying my ticket to Gophercon immediately
Re:Go 1.5 max procs default by bketelsen on Thursday May 28, 2015 @07:50PM (#9621915)
I just scanned registrations and don't see you there....
Re:Go 1.5 max procs default by sacado2 on Friday May 29, 2015 @05:42AM (#9623594)
Too bad they don't include range datatypes, à la Ada, where you can state "x is a number in [3;17]". Those exist since the 1970s. I can't imagine how one can ever write a program without range datatypes.

Oh, I need self-modifying code and both computed and assigned gotos, too. I'm used to using them since FORTRAN.

Come on, Go team, fix your language so that we can start using it.

Re:Go 1.5 max procs default by Dewie3 on Thursday May 28, 2015 @05:09PM (#9621204)
Pity about the algebraic data types + multiple inheritance. That probably won't play nice.
Re:Go 1.5 max procs default by Rapzid on Thursday May 28, 2015 @07:27PM (#9621837)
Totally. Even the guy who first introduced data types + multiple inheritance has come out to say that it's the worst thing he has ever done in the whole history of everything from always.
Re:Go 1.5 max procs default by ngrilly on Friday May 29, 2015 @06:56AM (#9623817)
Who is that guy?
Re:Go 1.5 max procs default by Rapzid on Friday May 29, 2015 @04:07PM (#9626952)
No guy, this is sort of an inside joke about the nil discussion. Every time Hoare comes up.
Re:Go 1.5 max procs default by ngrilly on Friday May 29, 2015 @04:20PM (#9627036)
Got it. Thanks :-)
Re:Go 1.5 max procs default by Dewie3 on Thursday May 28, 2015 @07:59PM (#9621944)
Well let's not exaggerate. Covariance can still be dealt with to some degree.
Re:Go 1.5 max procs default by aikah on Thursday May 28, 2015 @04:46PM (#9621069)
> Any updates regarding generics and error handling?

Don't hold your breath. it's unlikely the go team will add generics to the language, that's obviously a political issue not a technical one. Same for error handling. At least 2 people on the record, including Rob Pike said no new feature will be added to the language.

It doesn't mean you should stop asking for them, but it ultimately means that people wanting generics and other features in Go should consider a fork

Forks are ALWAYS healthy, the nodejs/iojs story is yet another proof of it. The thing people wanted (iojs) has won over the original project, which forced nodejs merge iojs back.

Like many I personally think Go isn't striking the right balance between minimalism and features. People who are against generics are in favor of trading compile time type checking(which is always safe) for run time type assertions(which can fail). But they refuse to acknowledge that fact. That's what make their argument against generics wrong and will ultimately damage any potential growth for the language.They are basically working against their own interests.

Re:Go 1.5 max procs default by rsc on Thursday May 28, 2015 @10:48PM (#9622417)
I'm sorry, but no: Generics are a technical issue and are not a political one. The Go team is not against generics per se, only against doing things that are not well understood and/or don't work well with Go.

There are deep technical issues that must be solved to fit the idea of generics into Go in a way that works well with the rest of the system, and we don't have solutions to those. I wrote on my blog about one issue years ago (http://research.swtch.com/generic), but there are others too. Even supposing you get past the problem on that page, the next thing you would run into is how to allow programmers to omit type annotations in a useful, easy-to-explain way. As an example, C++ lets you write make_pair(1, "foo") instead of make_pair<int, string>(1, "foo"), but the logic behind inferring the annotations takes pages and pages of specification, which doesn't make for a particularly understandable programming model, nor something the compiler can easily explain when things go wrong. And then there's a princess in another castle after that one I am sure.

We have spoken to a few true experts in Java generics and each of them has said roughly the same thing: be very careful, it's not as easy as it looks, and you're stuck with all the mistakes you make. As a demonstration, skim through most of http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.ht... and see how long before you start to think "was this really the best way to do this?" (For example, http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypePa..., but note that the latter page is only one part of the FAQ, not the entire FAQ.)

To be very clear, we acknowledge this fact: there are definite disadvantages to not having generics. You either use interface{} and give up compile-time checking or you write code generators and complicate your build process. But there are also definite disadvantages to generics as implemented in existing languages, and there is a very large advantage to not compromising today: it makes adopting a better solution tomorrow that much easier.

As I said in the interview at http://www.pl-enthusiast.net/2015/03/25/interview-with-gos-r...:

> Go is more an engineering project than a pure research project. Like most engineering, it is fundamentally conservative, using ideas that are proven and well understood and will work well together. The research literature’s influence comes mainly through experience with its application in earlier languages. For example, the experience with CSP applied in a handful of earlier languages—Promela, Squeak, Newsqueak, Alef, Limbo, even Concurrent ML—was just as crucial as Hoare’s original paper to bringing that idea to practice in Go. Programming language researchers are sometimes disappointed that Go hasn’t picked up more of the recent ideas from the literature, but those ideas simply haven’t had time to pass through the filter of practical experience.

I believe generics is one of those ideas. It certainly needs at least one more iteration, possibly a few more than that.

Re:Go 1.5 max procs default by anacrolix on Friday May 29, 2015 @06:56AM (#9623818)
CSP is well understood because it's used in very minority languages, yet generics aren't despite being almost ubiquitous?

I understand the caution, but this justification doesn't add up.

Re:Go 1.5 max procs default by jlouis on Friday May 29, 2015 @07:44AM (#9623962)
The complexity in language theory does not stem from a single concept, but from their mix. If you take something like generics on its own, it is rather simple to add to a language. But once you mix it with other concepts, the complexity rises exponentially.

Generics + subtyping (inheritance) gives rise to a number of complex situations. Java needed to embrace bounded polymorphism in the type system in order to handle this. And we don't know about a simpler type system which is sound and has that particular mix. If you remove subtyping and replace it with another construct, type classes or implicits, then generics are somewhat easier to fit to the language.

CSP turns out to be far more orthogonal, as long as you use a typed channel primitive. Hence, it is easier to fit CSP into an existing model because its composition with other type theoretic constructs is far simpler.

Re:Go 1.5 max procs default by rsc on Friday May 29, 2015 @07:16AM (#9623870)
The concept is ubiquitous. The specific design for each language is different, and what they all seem to have in common is that they require enormous complexity. See the rest of what I wrote.
Re:Go 1.5 max procs default by zerr on Friday May 29, 2015 @02:15AM (#9623003)
Well, the fact is that many mainstream languages have Generics. You have an advantage to learn on others mistakes (e.g. made by those Java guys) and practice.

I understand that Go team are more "systems" persons rather than "languages" in general. Did you try to consult with Dart team? e.g. with Gilad Bracha. Maybe you should consider hiring some languages person in Go team.

Re:Go 1.5 max procs default by PopsiclePete on Friday May 29, 2015 @12:44PM (#9625663)
It's just not an easy problem to solve. And I'm not convinced it has been already solved, much less solved correctly, in the vast majority of cases.

This is legal(-ish) C++:

template<typename T> T Add(T one, T two){ return one + two; }

It's completely illegal in C#. And Java. Both have "generics". Both are wildly different.

Then you have the Haskell camp which look at all of these "generics" and shake their heads and laugh bitterly since their static type system and "generic" blow all other ones out of the water anyway.

So when you say you want "generics" - which flavor do you want? How does it play with Go's interfaces? How deep down the rabbit hole do you go?

It's very easy, when you're not familiar with the problem to say "just do it" - but everyone seems to have their own idea of what "generics" is, how it works, how to constrain parameters, etc.

So even if the Go team picked an implementation from Camp A, I'm 120% positive that camps B, C, D, and X would declare it the worst implementation ever, and again, they've pleased no-one.

I'm glad they're sticking to their guns on this one.

Show them an implementation that works in Go, and they've said multiple times they might do it. Put up or shut up, basically.

Re:Go 1.5 max procs default by zerr on Friday May 29, 2015 @02:10PM (#9626295)
I don't understand your logic - just because different languages have some differences in how generic compile-time type-safe code is written, Go should NOT have this at all? And the only reason is that some subgroup might not be fully pleased?

I'm a C++ engineer more than a decade now.. And I'll be more than happy if Go had ANY kind of generics - even Ada-like, with explicit instantiation... Anything is better than current interface{} run-time checked stuff.

Re:Go 1.5 max procs default by PopsiclePete on Friday May 29, 2015 @04:27PM (#9627084)
Sounds like you have something in mind. All you have to do now, is:

1. Expand on your idea with some examples. 2. Show how this can be done without breaking existing Go code 3. Showing where the performance hits are - runtime? compile time? binary size? memory? 4. Show how this plays along with Go's implementation of interfaces, as well as other already-generic types, such as channels and maps.

If you can do all that, realistically, then I don't see why it wouldn't be taken seriously?

Heck, if you can provide even an example implementation (talk is increasingly cheap) I bet you'll get lots of people on-board!

You seem, like many others, to think that Go core team members don't want "generics". All they have ever said is - "we don't want bad generics". That's all.

Anyone can say "I don't know what exactly Go generics are, how they look like, how they perform, how they change the syntax, all I know is - I want them". Like I said, talk is cheap.

Re:Go 1.5 max procs default by codygman on Friday May 29, 2015 @01:07PM (#9625804)
> Show them an implementation that works in Go, and they've said multiple times they might do it. Put up or shut up, basically.

Didn't someone fork Go and do exactly that only to get ignored? Perhaps it was a rumor, do you know? I'll see if I can find any reference to it.

Re:Go 1.5 max procs default by dilap on Saturday May 30, 2015 @03:33PM (#9631479)
That would be interesting to see. (I've never heard of such a thing...)
Re:Go 1.5 max procs default by codygman on Saturday May 30, 2015 @06:36PM (#9632053)
Best I could find was this:

https://groups.google.com/forum/#!topic/golang-nuts/L5Lothlv...

It also led to a real world example where the author tried using Go for a project and had a lot of need for Generics:

http://oneofmanyworlds.blogspot.com/2011/11/draft-2-of-propo...

Re:Go 1.5 max procs default by enneff on Friday May 29, 2015 @03:59AM (#9623297)
Many members of the Go team have a background in languages, and are part of a greater community of software practitioners involved with language design. Of course they have discussed these topics extensively with many people; they do not exist inside a vacuum.
Re:Go 1.5 max procs default by davecheney on Friday May 29, 2015 @02:57AM (#9623134)
> You have an advantage to learn on others mistakes (e.g. made by those Java guys) and practice.

And the lesson learnt from studying other languages is "Don't add generics unless it's right for the language, even if that means choosing, on balance, to _NOT_ implement them at all".

Re:Go 1.5 max procs default by Jweb_Guru on Friday May 29, 2015 @06:13AM (#9623681)
Can you provide some examples of languages where people regret having implemented generics at all (as opposed to wishing they had been implemented in a different way)?
Re:Go 1.5 max procs default by davecheney on Friday May 29, 2015 @06:40AM (#9623764)
Java is the obvious example that springs to mind. Because of the requirement to be backwards compatible with Java 1.4, all the type information is erased during compilation. The call for reified types in Java has been heard for over a decade now.

C++ compile type templating is the cause of egregiously long compilation speeds. One of the original drivers for the creation of Go was the speed of C++ compilation.

I don't think you can separate a desire that generics was implemented a different way in these examples from the regret that their current implementation causes.

Re:Go 1.5 max procs default by jlouis on Friday May 29, 2015 @07:47AM (#9623981)
If you are willing to pay with execution speed, you can get fast compiles for generics. But C++ opted for fast execution speed and hence pay with long compile times.

I'd much rather have fast compilation and slower execution and some kind of generics, but the current situation is that people are insanely attached to their pride in fast program execution.

Re:Go 1.5 max procs default by james4k on Friday May 29, 2015 @10:27PM (#9628619)
This is a common argument, but too much software is painfully slow to use. It becomes a user experience problem.
Re:Go 1.5 max procs default by Dewie3 on Friday May 29, 2015 @11:17AM (#9625069)
I thought the lesson was "adding generics after the point where you have to care about backwards compatibility is fraught with peril".
Re:Go 1.5 max procs default by gbbr on Saturday May 30, 2015 @04:58AM (#9629536)
What is generics?
Re:Go 1.5 max procs default by sirseal on Friday May 29, 2015 @02:25AM (#9623039)
Go is situated as a better node.js. The entire language appeals to people who come from dynamic language backgrounds: python, ruby, javascript, etc. It is also a language that actively works against clever, intelligent, elegant programmers [1]. Rob Pike himself has stated that Go is intended for unintelligent people [1, 2].

Go is the new Java (<=1.5). It's slightly better....but it's not a language that will grow with you. If you're a serious programmer, you'll easily outstrip the usefulness and expressiveness of Go.They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the lang tl;dr: Go is uage that we give them has to be easy for them to understand and easy to adopt.

[1] http://nomad.so/2015/03/why-gos-design-is-a-disservice-to-in... [2] http://channel9.msdn.com/Events/Lang-NEXT/Lang-NEXT-2014/Fro...

Re:Go 1.5 max procs default by dvirsky on Friday May 29, 2015 @08:23AM (#9624106)
Easy to pick up and deliver with != intended for unintelligent people. At the end of the day, writing software is minimizing effort vs maximizing impact. If a language takes me there faster in practice and has an easier learning curve so team adoption is easier - I'd pick it. Go is pragmatic, and that's what I like about it. I'd like to see generics in Go, but the "blue collar"/"dumb programmer" argument is just a bit of ad-hominem IMO.

Coming from years of doing both Python/JS and C/C++, Go is a nice balance between the stong points of each camp, and it fits amazingly well in some cases. I hope it will be the new Java, because I love writing in Go and hate writing in Java :)

Re:Go 1.5 max procs default by Thaxll on Thursday May 28, 2015 @03:00PM (#9620343)
Could people stop trolling about generics on every Golang topics?
Re:Go 1.5 max procs default by zerr on Thursday May 28, 2015 @03:12PM (#9620425)
The Golang FAQ mentions from the day one that they are going to consider adding ge<censored>ics someday in the future. So I was wandering if there are any updates regarding this. I didn't expect such a fanboysm though...
Re:Go 1.5 max procs default by kjksf on Thursday May 28, 2015 @03:32PM (#9620563)
The FAQ also says that Go 1 will not introduce backwards-incompatible changes. Generics would be such a backwards-incompatible change.

So the answer to "are there generics in 1.x release" will always be "no".

http://golang.org/doc/faq#What_is_the_status_of_the_project http://golang.org/doc/go1compat

Go 2 is years away (if it even happens).

Re:Go 1.5 max procs default by chc on Thursday May 28, 2015 @04:11PM (#9620830)
How are generics backward-incompatible? They would obviously affect forward compatibility, but what previously valid programs would have to become invalid with the introduction of generics? (Incidentally, as an interesting contrast, this GOMAXPROCS default change will break some existing programs.)
Re:Go 1.5 max procs default by prodigal_erik on Thursday May 28, 2015 @07:19PM (#9621804)
The only way to keep old code working would be to add generics but continue having an awful standard library that never uses them.
Re:Go 1.5 max procs default by knodi on Thursday May 28, 2015 @04:24PM (#9620923)
How will GOMAXPROCS default change break existing programs?
Re:Go 1.5 max procs default by chc on Thursday May 28, 2015 @04:45PM (#9621067)
Per the OP: "Increased parallelism could make bugs in racy programs more likely to cause crashes or other problems. The setting of GOMAXPROCS=1 may have thus far let those bugs go undetected. Raising it may therefore make buggy programs less reliable."
Re:Go 1.5 max procs default by ecnahc515 on Thursday May 28, 2015 @04:37PM (#9621012)
GOMAXPROCS isn't really a language feature, that's all implementation specific AFAIC.
Re:Go 1.5 max procs default by anonymoushn on Thursday May 28, 2015 @04:45PM (#9621063)
What old code would break when adding generics?
Re:Go 1.5 max procs default by zerr on Thursday May 28, 2015 @03:43PM (#9620635)
>"are there generics in 1.x release"

I've never asked this. Certainly it would have been a big news. I asked if there are any updates in general - any new thoughts, plans...

Re:Go 1.5 max procs default by the_why_of_y on Friday May 29, 2015 @06:09AM (#9623673)
Generics were added to Java 1.5 in a backwards compatible way: all your existing Java code would build fine with Java 1.5 javac. So it is not inherently impossible.
Re:Go 1.5 max procs default by rsc on Thursday May 28, 2015 @03:28PM (#9620539)
Even if there were news, it's certainly off topic for this post.
Re:Go 1.5 max procs default by andrewchambers on Thursday May 28, 2015 @07:05PM (#9621747)
If you ever implement it, I suggest a release on april 1st.
Re:Go 1.5 max procs default by artursapek on Thursday May 28, 2015 @09:30PM (#9622214)
That would be my favorite April Fools ever.