From 7b15ed9ef455b6b66c6b376898a88aef5d6a9970 Mon Sep 17 00:00:00 2001
From: Ondřej Surý
Date: Tue, 26 Apr 2011 09:55:32 +0200
Subject: Imported Upstream version 2011.04.13
---
doc/go_spec.html | 69 +++++++++++++++++++++++++-------------------------------
1 file changed, 31 insertions(+), 38 deletions(-)
(limited to 'doc/go_spec.html')
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 85dfc44bd..f8fe5974a 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,5 +1,5 @@
-
+
Receiving from a nil channel causes a
@@ -4009,9 +4009,8 @@ iteration values for each entry will be produced at most once.
For channels, the iteration values produced are the successive values sent on
-the channel until the channel is closed; it does not produce the zero value sent
-before the channel is closed
-(§close and closed).
+the channel until the channel is closed
+(§close).
@@ -4086,12 +4085,9 @@ cases all referring to communication operations.
SelectStmt = "select" "{" { CommClause } "}" .
CommClause = CommCase ":" { Statement ";" } .
CommCase = "case" ( SendStmt | RecvStmt ) | "default" .
-RecvStmt = [ Expression ( "=" | ":=" ) ] RecvExpr .
+RecvStmt = [ Expression [ "," Expression ] ( "=" | ":=" ) ] RecvExpr .
RecvExpr = Expression .
-
RecvExpr must be a receive operation.
@@ -4122,27 +4118,24 @@ in the "select" statement.
If multiple cases can proceed, a pseudo-random fair choice is made to decide
which single communication will execute.
-
-The receive case may declare a new variable using a
+The receive case may declare one or two new variables using a
short variable declaration.
-var c, c1, c2 chan int
+var c, c1, c2, c3 chan int
var i1, i2 int
select {
case i1 = <-c1:
print("received ", i1, " from c1\n")
case c2 <- i2:
print("sent ", i2, " to c2\n")
-
default:
print("no communication\n")
}
@@ -4212,7 +4205,7 @@ func complex_f2() (re float64, im float64) {
The expression list may be empty if the function's result
- type specifies names for its result parameters (§Function Types).
+ type specifies names for its result parameters (§Function Types).
The result parameters act as ordinary local variables
and the function may assign values to them as necessary.
The "return" statement returns the values of these variables.
@@ -4222,6 +4215,11 @@ func complex_f3() (re float64, im float64) {
im = 4.0
return
}
+
+func (devnull) Write(p []byte) (n int, _ os.Error) {
+ n = len(p)
+ return
+}
@@ -4259,11 +4257,13 @@ terminates
-L: for i < n {
- switch i {
- case 5: break L
+L:
+ for i < n {
+ switch i {
+ case 5:
+ break L
+ }
}
-}
Continue statements
@@ -4305,8 +4305,8 @@ instance, this example:
-goto L // BAD
-v := 3
+ goto L // BAD
+ v := 3
L:
@@ -4396,8 +4396,7 @@ BuiltinCall = identifier "(" [ BuiltinArgs [ "," ] ] ")" .
BuiltinArgs = Type [ "," ExpressionList ] | ExpressionList .
-
-Close and closed
+Close
For a channel c, the built-in function close(c)
@@ -4407,12 +4406,8 @@ After calling close, and after any previously
sent values have been received, receive operations will return
the zero value for the channel's type without blocking.
-
-After at least one such zero value has been
-received, closed(c) returns true.
+The multi-valued receive operation
+returns a received value along with an indication of whether the channel is closed.
@@ -4700,7 +4695,7 @@ func protect(g func()) {
if x := recover(); x != nil {
log.Printf("run time panic: %v", x)
}
- }
+ }()
log.Println("start")
g()
}
@@ -5152,6 +5147,4 @@ The following minimal alignment properties are guaranteed:
Implementation differences - TODO
- Implementation does not honor the restriction on goto statements and targets (no intervening declarations).
- - Gccgo: Method expressions are partially implemented.
- - Gccgo: allows only one init() function per source file.
--
cgit v1.2.3