From ba02a044f3aac725d0c04f421348313fa3cb6590 Mon Sep 17 00:00:00 2001
From: Rob Pike
+A blog post, title Constants, +explores this topic in more detail. +
+@@ -971,7 +976,7 @@ It is a handy reference for people doing code reviews for Go projects. How do I submit patches to the Go libraries?
-The library sources are in go/src
.
+The library sources are in the src
directory of the repository.
If you want to make a significant change, please discuss on the mailing list before embarking.
-We considered writing gc
, the original Go compiler, in Go itself but
+We considered using LLVM for gc
but we felt it was too large and
+slow to meet our performance goals.
+
+We also considered writing gc
, the original Go compiler, in Go itself but
elected not to do so because of the difficulties of bootstrapping and
especially of open source distribution—you'd need a Go compiler to
set up a Go environment. Gccgo
, which came later, makes it possible to
-consider writing a compiler in Go, which might well happen.
-(Go would be a
-fine language in which to implement a compiler; a native lexer and
-parser are already available in the go
package
-and a type checker is in the works.)
+consider writing a compiler in Go.
+A plan to do that by machine translation of the existing compiler is under development.
+A separate document
+explains the reason for this approach.
-We also considered using LLVM for gc
but we felt it was too large and
-slow to meet our performance goals.
+That plan aside,
+Go is a
+fine language in which to implement a self-hosting compiler: a native lexer and
+parser are already available in the go
package
+and a separate type checking
+package
+has also been written.
-Again due to bootstrapping issues, the run-time code is mostly in C (with a
-tiny bit of assembler) although Go is capable of implementing most of
-it now. Gccgo
's run-time support uses glibc
.
-Gc
uses a custom library to keep the footprint under
+Again due to bootstrapping issues, the run-time code was originally written mostly in C (with a
+tiny bit of assembler) although much of it has been translated to Go since then
+and one day all of it might be (except for the assembler bits).
+Gccgo
's run-time support uses glibc
.
+Gc
uses a custom C library to keep the footprint under
control; it is
compiled with a version of the Plan 9 C compiler that supports
resizable stacks for goroutines.
@@ -1637,8 +1652,8 @@ A simple C "hello, world" program compiled and linked statically using gcc
on Linux is around 750 kB,
including an implementation of printf
.
An equivalent Go program using fmt.Printf
-is around 1.2 MB, but
-that includes more powerful run-time support.
+is around 1.9 MB, but
+that includes more powerful run-time support and type information.
+Nowadays, most Go programmers use a tool, +goimports, +which automatically rewrites a Go source file to have the correct imports, +eliminating the unused imports issue in practice. +This program is easily connected to most editors to run automatically when a Go source file is written. +
+