diff --git a/doc/go_spec.html b/doc/go_spec.html index b5931c110e..3823876457 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1107,6 +1107,19 @@ SendChannel = "chan" "<-" ElementType . RecvChannel = "<-" "chan" ElementType . +

+To avoid a parsing ambiguity in cases such as chan<- chan int, +the Channel production's ElementType cannot be a RecvChannel. +To construct such a type, parenthesize the RecvChannel first. +

+ +
+chan<- chan int     // same as chan<- (chan int)
+chan<- <-chan int   // same as chan<- (<-chan int)
+<-chan <-chan int   // same as <-chan (<-chan int)
+chan (<-chan int)
+
+

Upon creation, a channel can be used both to send and to receive values. By conversion or assignment, a channel may be constrained only to send or @@ -1126,7 +1139,6 @@ value can be made using the built-in function make, which takes the channel type and an optional capacity as arguments:

-
 make(chan int, 100)