Go is quite literally written by the people who invented C, wrote C, and made it what it is today. (Ken Thompson wrote one of the first commits to the language).
The reason for purging C from the Go toolchain is that it makes it harder for Go developers to contribute. Go developers already all know Go (by definition) - why make them use a language that they may not know as well in order to contribute back to the project?
Furthermore, mixing C code with Go code can cause performance issues if not done right. While you can expect the official project to "do it right", this still raises the bar for people who know Go and want to contribute, but don't know C as well.
And frankly, I don't think it's that significant to say that they don't want to write C anymore. C was a great language for its time, and it still is a great language in many ways. But it's almost half a century old; it would be more surprising if after almost 50 years they couldn't write a language that they prefer even more!
This is why Go was maintaining it's own C compiler -- They had it modified to work well with Go, as far as I am aware[1].
Removing it means one less compiler to maintain.
[1] From Go 1.4, the source for the Go C compiler: https://github.com/golang/go/tree/883bc6ed0ea815293fe6309d66...
I think one could foresee making more changes in the future in that area. It's sort of exciting to think that these fairly low level foundational details which much of programming relies on, could be rethought and maybe get us to a different place than we are now.
- Generics in current form won't work across the board with all parts of Go.
- Generics of form that will work for Go across the board are not technically trivial.
Honestly, I appreciate Go's philosophy of not implementing until fully understood and accepted. Besides, Go's primary design principle is that of composability. So you're using reflection in one form or another. Achieving generic behaviour with interface and reflection is much more consistent than generics as we know from other languages.
They've been saying that from the begining. There are no real technical constraints, it's been done in all kinds of languages and it has been a well understood feature for 2+ decades. They just don't want to do the compromises needed, while letting the developers continue to deal with all of them...
See also pcwalton's (of Rust fame) comment below.
From the outside, the two features (swift's protocol with extensions and go interfaces) seem a bit close, so that made me wonder. I didn't have the time to think too much in detail about it, so i'm just wondering if anybody already had.
We have this discussion after every minor release. 1.6 will be released in December. See you then.
type V interface{}
Don't hold your breath when it comes to generics. There is no way they can retrofit them without breaking the language, it's too late. Even features like covariance or unions are just out of question.
An option would be to write a super-set of Go with generics that would compile to Go code. what it would do basically is use interface{} everywhere the variable type T is required and insert type assertions for the user. Been thinking about that.
I think that's pretty much how you'd want to do it, it's type erasure just like generics in Java - sure, some people complain about not having reified generics, but I'm more concerned about type-safety, Go already has some runtime reflection capabilities anyway.
You could call it go++!
(But seriously, that's pretty much what C++ did to C.)
For my tiny hobby projects, compile times aren't an issue at all so I'm asking purely out of curiosity.
Is it? It might not be particularly optimized, but why would that ("very bad speed wise") be the case?
I imagine that's just a side-effect of rewriting the entire compiler; I'd expect the next versions to improve on the speed.
Though in the meantime, if compilation time is an issue, you can always try gccgo. On my larger projects, it's slightly faster than gc 1.5. YMMV, obviously.
[0] https://groups.google.com/d/topic/golang-dev/6obxRcm-rqc/dis...
I read that it mainly had to do with lack of escape analysis, has this changed in recent gcco releases ?
...and all of a sudden, GC becomes a non-issue for all but the most highly performing software.
(Pause time is not the only metric that matters; thinking that it is is a common misconception about GC that bugs me.)
env GOOS=linux GOARCH=arm GOARM=7 go build hello.go
This link is a good summary of the situation now and in future:http://dave.cheney.net/2015/03/03/cross-compilation-just-got...
This one talks about cgo:
https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba...
Are there any more details about the change to goroutine scheduling? Is this more than the just change to the GOMAXPROCS' default value?
That would defeat the repetition about scheduling order being undefined wouldn't it?
But according to issue 11372 the answer is that up to 1.4 the scheduler would run goroutines in definition order so if you started goroutines 1,2,3,4,5 it tended to run 1,2,3,4,5. In 1.5 it's biased to favour the last-started routine so it'd run 5,1,2,3,4. Again scheduling order is undefined so the order may change again in 1.6, explicitly relying on it would be an idiotic idea.
They have also introduced limited scheduling randomisation in race detection mode[0] which they intend to randomise further in 1.6 to make scheduling-order dependencies easier to suss out and fix.
> Is this more than the just change to the GOMAXPROCS' default value?
The change to GOMAXPROCS wouldn't have changed the order in which the scheduler picks routines, since it could already be set to a non-default value previously.
[0] https://github.com/golang/go/commit/202807789946a8f3f415bf00...
https://twitter.com/maver/status/496376555237806080
but in Feb the story changed and with this release it's well on it's way to a full port.
For Apple this makes sense if they want to switch architectures or add additional extensions to their CPU's and not require all developers to re-submit their apps, but it sucks a bit for the darwin/arm64 port of Go. Maybe we'll see an LLVM bytecode target in a few years? Then Go applications could also benefit from LLVM optimizations.
Projects slip, especially ones like this which are fairly large and complex. I want Go plugins, too... but it takes time, and shared libraries were higher priority. Once the bugs are shaken out of shared libraries, plugins become a pretty logical (and hopefully small) next step.
The final version should be released in mid-August.