From 19d9a408451662d09b49fe3b0f1971728e28213f Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 27 Jan 2011 15:34:28 -0500 Subject: [PATCH] spec: remove non-blocking channel operators Add intended changes for close + closed, commented out. R=golang-dev, niemeyer, r, gri1 CC=golang-dev https://golang.org/cl/4013045 --- doc/go_spec.html | 59 ++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 51ece74d72..2d7f7768a5 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,5 +1,5 @@ - +

Except in a communications clause of a select statement, @@ -4097,6 +4078,9 @@ SelectStmt = "select" "{" { CommClause } "}" . CommClause = CommCase ":" { Statement ";" } . CommCase = "case" ( SendExpr | RecvExpr) | "default" . SendExpr = Expression "<-" Expression . + RecvExpr = [ Expression ( "=" | ":=" ) ] "<-" Expression . @@ -4128,6 +4112,7 @@ 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 short variable declaration.

@@ -4140,6 +4125,14 @@ case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: print("sent ", i2, " to c2\n") + default: print("no communication\n") } @@ -4393,6 +4386,7 @@ BuiltinCall = identifier "(" [ BuiltinArgs [ "," ] ] ")" . BuiltinArgs = Type [ "," ExpressionList ] | ExpressionList . +

Close and closed

@@ -4402,6 +4396,11 @@ sending to or closing a closed channel causes a run-t 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.

-- 2.48.1