1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:34:40 -07:00

spec: permit trailing comma in conversions

Also: Adjust prose in Conversions section
to be consistent.

This is a backward-compatible syntax change.
For a discussion see issue 2568.

Fixes #2568.
Fixes #4123.

R=golang-dev, r, iant, rsc
CC=golang-dev
https://golang.org/cl/6572049
This commit is contained in:
Robert Griesemer 2012-09-26 10:31:57 -07:00
parent 3c9eb5b48e
commit 60a6ae8c3c

View File

@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of September 22, 2012",
"Subtitle": "Version of September 26, 2012",
"Path": "/ref/spec"
}-->
@ -3390,7 +3390,7 @@ that can be converted to type <code>T</code>.
</p>
<pre class="ebnf">
Conversion = Type "(" Expression ")" .
Conversion = Type "(" Expression [ "," ] ")" .
</pre>
<p>
@ -3464,12 +3464,11 @@ in any of these cases:
<code>x</code>'s type and <code>T</code> are both complex types.
</li>
<li>
<code>x</code> is an integer or has type <code>[]byte</code> or
<code>[]rune</code> and <code>T</code> is a string type.
<code>x</code> is an integer or a slice of bytes or runes
and <code>T</code> is a string type.
</li>
<li>
<code>x</code> is a string and <code>T</code> is <code>[]byte</code> or
<code>[]rune</code>.
<code>x</code> is a string and <code>T</code> is a slice of bytes or runes.
</li>
</ul>