mirror of
https://github.com/golang/go
synced 2024-11-21 20:14:52 -07:00
go spec: fix and clarify syntax of conversions
Fixes #803. R=rsc, r, iant, ken2 CC=golang-dev https://golang.org/cl/1281041
This commit is contained in:
parent
1d6eb74697
commit
934a520d75
@ -1,5 +1,5 @@
|
||||
<!-- title The Go Programming Language Specification -->
|
||||
<!-- subtitle Version of May 14, 2010 -->
|
||||
<!-- subtitle Version of May 24, 2010 -->
|
||||
|
||||
<!--
|
||||
Todo
|
||||
@ -3254,7 +3254,18 @@ that can be converted to type <code>T</code>.
|
||||
</p>
|
||||
|
||||
<pre class="ebnf">
|
||||
Conversion = LiteralType "(" Expression ")" .
|
||||
Conversion = Type "(" Expression ")" .
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
If the type starts with an operator it must be parenthesized:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
*Point(p) // same as *(Point(p))
|
||||
(*Point)(p) // p is converted to (*Point)
|
||||
<-chan int(c) // same as <-(chan int(c))
|
||||
(<-chan int)(c) // c is converted to (<-chan int)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
Loading…
Reference in New Issue
Block a user