summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2010-05-24 14:58:26 -0700
committerRobert Griesemer <gri@golang.org>2010-05-24 14:58:26 -0700
commita08d70a3dc91478a6959e4a48bcdfa0921104c9b (patch)
treeda10c48a067e959f9a1c0df3a845070313a1a023
parent20049bf9714521e66654e19a59a149f2ed6e24df (diff)
downloadgolang-a08d70a3dc91478a6959e4a48bcdfa0921104c9b.tar.gz
go spec: fix and clarify syntax of conversions
Fixes issue 803. R=rsc, r, iant, ken2 CC=golang-dev http://codereview.appspot.com/1281041
-rw-r--r--doc/go_spec.html23
1 files changed, 17 insertions, 6 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 156ee6a45..8c958b159 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -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)
+&lt;-chan int(c) // same as &lt;-(chan int(c))
+(&lt;-chan int)(c) // c is converted to (&lt;-chan int)
</pre>
<p>
@@ -3318,11 +3329,11 @@ string containing the UTF-8 representation of the integer.
Negative values are converted to <code>"\uFFFD"</code>.
<pre>
-string('a') // "a"
-string(-1) // "\ufffd" == "\xef\xbf\xbd "
-string(0xf8) // "\u00f8" == "ø" == "\xc3\xb8"
+string('a') // "a"
+string(-1) // "\ufffd" == "\xef\xbf\xbd "
+string(0xf8) // "\u00f8" == "ø" == "\xc3\xb8"
type MyString string
-MyString(0x65e5) // "\u65e5" == "日" == "\xe6\x97\xa5"
+MyString(0x65e5) // "\u65e5" == "日" == "\xe6\x97\xa5"
</pre>
</li>