From 48ecfc979ffb209c2705f594c4edc6c8c8829486 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Wed, 27 Mar 2013 15:26:57 -0700 Subject: [PATCH] faq: update with some links and 1.1-specific details R=golang-dev, remyoudompheng, iant CC=golang-dev https://golang.org/cl/8038048 --- doc/go_faq.html | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/doc/go_faq.html b/doc/go_faq.html index 3e742d9f78..63ad66c519 100644 --- a/doc/go_faq.html +++ b/doc/go_faq.html @@ -157,6 +157,12 @@ and so on. These cannot be addressed well by libraries or tools; a new language was called for.

+

+The article Go at Google +discusses the background and motivation behind the design of the Go language, +as well as providing more detail about many of the answers presented in this FAQ. +

+

What are Go's ancestors?

@@ -216,6 +222,13 @@ document server running in a production configuration on Google App Engine.

+

+Other examples include the Vitess +system for large-scale SQL installations and Google's download server, dl.google.com, +which delivers Chrome binaries and other large installables such as apt-get +packages. +

+ @@ -394,6 +407,8 @@ for concurrency comes from Hoare's Communicating Sequential Processes, or CSP. Occam and Erlang are two well known languages that stem from CSP. Go's concurrency primitives derive from a different part of the family tree whose main contribution is the powerful notion of channels as first class objects. +Experience with several earlier languages has shown that the CSP model +fits well into a procedural language framework.

@@ -874,11 +889,11 @@ There's a lot of history on that topic. Early on, maps and channels were syntactically pointers and it was impossible to declare or use a non-pointer instance. Also, we struggled with how arrays should work. Eventually we decided that the strict separation of pointers and -values made the language harder to use. Introducing reference types, -including slices to handle the reference form of arrays, resolved -these issues. Reference types add some regrettable complexity to the -language but they have a large effect on usability: Go became a more -productive, comfortable language when they were introduced. +values made the language harder to use. Changing these +types to act as references to the associated, shared data structures resolved +these issues. This change added some regrettable complexity to the +language but had a large effect on usability: Go became a more +productive, comfortable language when it was introduced.

Writing Code

@@ -1080,7 +1095,7 @@ There are several considerations. First, and most important, does the method need to modify the receiver? If it does, the receiver must be a pointer. -(Slices and maps are reference types, so their story is a little +(Slices and maps act as references, so their story is a little more subtle, but for instance to change the length of a slice in a method the receiver must still be a pointer.) In the examples above, if pointerMethod modifies @@ -1131,7 +1146,7 @@ of Effective Go for more details.

-Why is int 32 bits on 64 bit machines?

+What is the size of an int on a 64 bit machine?

The sizes of int and uint are implementation-specific @@ -1148,12 +1163,6 @@ floating-point numbers. The default size of a floating-point constant is float64.

-

-At the moment, all implementations use 32-bit ints, an essentially arbitrary decision. -However, we expect that int will be increased to 64 bits on 64-bit -architectures in a future release of Go. -

-

How do I know whether a variable is allocated on the heap or the stack?

@@ -1237,6 +1246,9 @@ run-time support to utilize more than one OS thread.

Programs that perform parallel computation should benefit from an increase in GOMAXPROCS. +However, be aware that +concurrency +is not parallelism.

@@ -1270,6 +1282,11 @@ should recognize such cases and optimize its use of OS threads. For now, GOMAXPROCS should be set on a per-application basis.

+

+For more detail on this topic see the talk entitled, +Concurrency +is not Parallelism. +

Functions and Methods

@@ -1503,9 +1520,11 @@ We considered writing gc, the original Go compiler, in Go itself bu 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 +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.) +parser are already available in the go package +and a type checker is in the works.)

-- 2.50.0