News for hackers. Stuff that matters.
Re:Go 1.5 is released by travjones on Wednesday August 19, 2015 @01:19PM (#10086981)
>"The compiler tool chain was translated from C to Go, removing the last vestiges of C code from the Go code base."

This is really cool. Writing a compiler in the language that you're compiling seems kind of meta. The language has evolved to a point to where it can consume and build itself. Far out mannnnn.

Thanks Go team!

Re:Go 1.5 is released by frou_dh on Wednesday August 19, 2015 @01:31PM (#10087080)
There is a good presentation from Pike talking all about the what/why/how of the C -> Go transition:

http://youtu.be/cF1zJYkBW4A

http://talks.golang.org/2015/gogo.slide

Re:Go 1.5 is released by andrepd on Wednesday August 19, 2015 @04:46PM (#10088354)
The term is self-hosting compiler, when a compiler can compile itself.

https://en.wikipedia.org/wiki/Self-hosting

Re:Go 1.5 is released by tankenmate on Thursday August 20, 2015 @03:05AM (#10090369)
As the old hacker snark says 'Any language that can't compile itself is a toy language'.
Re:Go 1.5 is released by gnuvince on Wednesday August 19, 2015 @01:51PM (#10087229)
How has this affected compile speeds? Go proponents often tout the speed at which it compiles code as an important feature, so I wonder if there's been a noticeable regression.
Re:Go 1.5 is released by sudhirj on Wednesday August 19, 2015 @02:02PM (#10087291)
Slower in the short term while the code remains transpiled from C. Will get faster as the team goes over it a couple times.
Re:Go 1.5 is released by rsc on Wednesday August 19, 2015 @02:05PM (#10087309)
Yes, this is a good summary.
Re:Go 1.5 is released by dmaz on Wednesday August 19, 2015 @01:57PM (#10087267)
> Builds in Go 1.5 will be slower by a factor of about two.

https://golang.org/doc/go1.5#performance

Re:Go 1.5 is released by semiquaver on Wednesday August 19, 2015 @05:26PM (#10088623)
The small increase in build times doesn't bother me at all when I'm generating a binary, but unfortunately it's very noticeable and irritating when using tools like vim-go or syntastic which type-check/lint/gofmt your code. Using these now causes vim to be unresponsive for up to a second every time I save, whereas the delay used to be insignificant.
Re:Go 1.5 is released by mseepgood on Wednesday August 19, 2015 @10:43PM (#10089793)
> which type-check/lint/gofmt your code

Those tools do not use the Go compiler. They're using go/ast or go/types. So the translation of gc from C to Go can't have affected them.

Re:Go 1.5 is released by bohrshaw on Thursday August 20, 2015 @05:05AM (#10090680)
They also build the source file, which is indeed much slower, to about 2x.
Re:Go 1.5 is released by chadaustin on Wednesday August 19, 2015 @02:00PM (#10087282)
Perhaps things have improved since then, but this thread indicates build times will regress a little:

https://groups.google.com/forum/#!msg/golang-dev/6obxRcm-rqc...

Re:Go 1.5 is released by vram22 on Wednesday August 19, 2015 @02:46PM (#10087590)
>This is really cool. Writing a compiler in the language that you're compiling seems kind of meta.

It's been done before, for more than one language, IIRC.

The technique by which they make an executable of a compiler for language L on platform B, using an existing executable of the same compiler for L on platform A, together with the source code of the compiler for L on A, is also cool. I forget the full details right now. Maybe someone else will pitch in and explain. It's called bootstrapping. It's also related to cross-compiling.

Update: Looked it up in Google:

https://en.wikipedia.org/wiki/Bootstrapping_(compilers)

https://en.wikipedia.org/wiki/Cross_compiler

Also see Canadian Cross under above article - this is like the cool technique I talked about above, but more complex.

Re:Go 1.5 is released by smithkl42 on Wednesday August 19, 2015 @03:55PM (#10088025)
TypeScript does the same thing - its compiler is written in TypeScript. See https://github.com/Microsoft/TypeScript/tree/master/src/comp.... But yeah, darned cool, and very meta.
Re:Go 1.5 is released by mrdrozdov on Wednesday August 19, 2015 @01:23PM (#10087015)
Perhaps this is a dumb question, but what language was used to compile the compiler? Was it compiled in C? Surely it must have had to of been compiled in a different language somewhere down the chain.
Re:Go 1.5 is released by crawshaw on Wednesday August 19, 2015 @01:24PM (#10087028)
It is built with Go 1.4. Details: https://golang.org/s/go15bootstrap
Re:Go 1.5 is released by rgbrenner on Wednesday August 19, 2015 @02:12PM (#10087358)
yes.. golang's compiler was originally in C. The process is called bootstrapping: https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
Re:Go 1.5 is released by whacker on Wednesday August 19, 2015 @01:25PM (#10087032)
The 1.5 build requires you to have a go1.4.2 build which is used as the bootstrapping compiler.
Re:Go 1.5 is released by turtles99999 on Wednesday August 19, 2015 @02:19PM (#10087402)
well, it's actually turtles all the way down.
Re:Go 1.5 is released by jlees on Wednesday August 19, 2015 @01:33PM (#10087103)
Although you can end up with fun situations like the C compiler backdoor: http://scienceblogs.com/goodmath/2007/04/15/strange-loops-de...
Re:Go 1.5 is released by rsc on Wednesday August 19, 2015 @02:06PM (#10087321)
You can start from the C version and move forward and check that you get the same result as starting with released Go binaries.

Unless you think Ken somehow backdoored the original C compilers to backdoor every C compiler in the world to backdoor the Go compilers that came about decades later. :-)

Re:Go 1.5 is released by bmir-alum-007 on Wednesday August 19, 2015 @05:42PM (#10088712)
Seems simpler to just backdoor the linker/library archiver, that way almost all toolchains are backdoored. ;)
Re:Go 1.5 is released by billjings on Wednesday August 19, 2015 @01:42PM (#10087164)
Haven't read the article you linked to, but the Brian Kernighan talk it discusses is fantastic, one of my favorite reads in the field:

https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thomp...

Re:Go 1.5 is released by vezzy-fnord on Wednesday August 19, 2015 @01:45PM (#10087190)
That's ken, not bwk.
Re:Go 1.5 is released by billjings on Thursday August 20, 2015 @10:53AM (#10092206)
D'oh. Thanks.
Re:Go 1.5 is released by berfarah on Wednesday August 19, 2015 @06:26PM (#10088978)
This might be a dumb question: What happens if you find a bug in the language? Let's say something that you had written in C was being misinterpreted, and now the go compiler still uses that byte-code to compile new versions of the compiler.

Or is that something that isn't really possible?

Re:Go 1.5 is released by emmab on Wednesday August 19, 2015 @07:10PM (#10089149)
You should read Reflections on Trusting Trust, it expands on this idea in the most beautiful way: https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thomp...
Re:Go 1.5 is released by jlouis on Wednesday August 19, 2015 @06:43PM (#10089053)
I think Russ showed the translated code produces the same binaries as the Go 1.4 C variant. So this isn't very likely given he has the option to pipe roughly any Open Source Go project through the compiler.