diff options
author | Robert Griesemer <gri@golang.org> | 2010-05-24 14:58:26 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2010-05-24 14:58:26 -0700 |
commit | 934a520d7586db9cf4f6c89470f41d0d06377425 (patch) | |
tree | d637b4575e3bac1e4659257e83a51100917d2a17 | |
parent | 1d6eb7469791f1b112a0e36721ef1a59878d82cb (diff) | |
download | go-934a520d7586db9cf4f6c89470f41d0d06377425.tar.gz go-934a520d7586db9cf4f6c89470f41d0d06377425.zip |
go spec: fix and clarify syntax of conversions
Fixes #803.
R=rsc, r, iant, ken2
CC=golang-dev
https://golang.org/cl/1281041
-rw-r--r-- | doc/go_spec.html | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index 156ee6a45b..8c958b159d 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) +<-chan int(c) // same as <-(chan int(c)) +(<-chan int)(c) // c is converted to (<-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> |