Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1c369bd5
Commit
1c369bd5
authored
Jan 27, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify parsing of channel types.
R=r, rsc CC=golang-dev
https://golang.org/cl/194091
parent
2a01d728
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
go_spec.html
doc/go_spec.html
+13
-1
No files found.
doc/go_spec.html
View file @
1c369bd5
...
...
@@ -1107,6 +1107,19 @@ SendChannel = "chan" "<-" ElementType .
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
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment