diff options
-rw-r--r-- | doc/go_spec.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index b5931c110..382387645 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1108,6 +1108,19 @@ RecvChannel = "<-" "chan" ElementType . </pre> <p> +To avoid a parsing ambiguity in cases such as <code>chan<- chan int</code>, +the Channel production's ElementType cannot be a RecvChannel. +To construct such a type, parenthesize the RecvChannel first. +</p> + +<pre> +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) +</pre> + +<p> 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 to receive. This constraint is called a channel's <i>direction</i>; either @@ -1126,7 +1139,6 @@ value can be made using the built-in function <code>make</code>, which takes the channel type and an optional capacity as arguments: </p> - <pre> make(chan int, 100) </pre> |