1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:44:39 -07:00

delete paragraph about unimplemented select-on-type feature.

change () to {} in all composite literals

DELTA=20  (0 added, 7 deleted, 13 changed)
OCL=25604
CL=25606
This commit is contained in:
Rob Pike 2009-03-02 17:52:52 -08:00
parent 4659685b8f
commit 426335f87b

View File

@ -1854,12 +1854,12 @@ mypackage.Math.Sin // if Math is declared in an intervening scope
Composite literals construct values for structs, arrays, slices, and maps Composite literals construct values for structs, arrays, slices, and maps
and create a new value each time they are evaluated. and create a new value each time they are evaluated.
They consist of the type of the value They consist of the type of the value
followed by a parenthesized list of expressions, followed by a brace-bound list of expressions,
or a list of expression pairs for map literals. or a list of expression pairs for map literals.
</p> </p>
<pre class="grammar"> <pre class="grammar">
CompositeLit = LiteralType "(" [ ( ExpressionList | ExprPairList ) [ "," ] ] ")" . CompositeLit = LiteralType "{" [ ( ExpressionList | ExprPairList ) [ "," ] ] "}" .
LiteralType = StructType | ArrayType | "[" "..." "]" ElementType | LiteralType = StructType | ArrayType | "[" "..." "]" ElementType |
SliceType | MapType | TypeName . SliceType | MapType | TypeName .
ExprPairList = ExprPair { "," ExprPair } . ExprPairList = ExprPair { "," ExprPair } .
@ -1884,7 +1884,7 @@ one may write
</p> </p>
<pre> <pre>
pi := Num(Rat(22, 7), 3.14159, "pi"); pi := Num{Rat{22, 7}, 3.14159, "pi"};
</pre> </pre>
<p> <p>
@ -1897,9 +1897,9 @@ to the number of elements in the literal.
</p> </p>
<pre> <pre>
buffer := [10]string(); // len(buffer) == 10 buffer := [10]string{}; // len(buffer) == 10
primes := [6]int(2, 3, 5, 7, 9, 11); // len(primes) == 6 primes := [6]int{2, 3, 5, 7, 9, 11}; // len(primes) == 6
days := [...]string("Sat", "Sun"); // len(days) == 2 days := [...]string{"Sat", "Sun"}; // len(days) == 2
</pre> </pre>
<p> <p>
@ -1909,7 +1909,7 @@ Thus, the length and capacity of a slice literal is the number of elements
</p> </p>
<pre> <pre>
[]T(x1, x2, ... xn) []T{x1, x2, ... xn}
</pre> </pre>
<p> <p>
@ -1917,7 +1917,7 @@ and is a shortcut for a slice operation applied to an array literal:
</p> </p>
<pre> <pre>
[n]T(x1, x2, ... xn)[0 : n] [n]T{x1, x2, ... xn}[0 : n]
</pre> </pre>
<p> <p>
@ -1926,7 +1926,7 @@ key-value pairs separated by a colon:
</p> </p>
<pre> <pre>
m := map[string]int("good": 0, "bad": 1, "indifferent": 7); m := map[string]int{"good": 0, "bad": 1, "indifferent": 7};
</pre> </pre>
<h3>Function literals</h3> <h3>Function literals</h3>
@ -1986,7 +1986,7 @@ x
2 2
(s + ".txt") (s + ".txt")
f(3.1415, true) f(3.1415, true)
Point(1, 2) Point{1, 2}
m["foo"] m["foo"]
s[i : j + 1] s[i : j + 1]
obj.color obj.color
@ -2198,7 +2198,7 @@ difference in the index values in the slice. After slicing the array <code>a</c
</p> </p>
<pre> <pre>
a := [4]int(1, 2, 3, 4); a := [4]int{1, 2, 3, 4};
s := a[1:3]; s := a[1:3];
</pre> </pre>
@ -3227,7 +3227,7 @@ after execution their values will be those of the last iteration.
<pre> <pre>
var a [10]string; var a [10]string;
m := map[string]int("mon":0, "tue":1, "wed":2, "thu":3, "fri":4, "sat":5, "sun":6); m := map[string]int{"mon":0, "tue":1, "wed":2, "thu":3, "fri":4, "sat":5, "sun":6};
for i, s := range a { for i, s := range a {
// type of i is int // type of i is int
@ -3317,11 +3317,6 @@ effects in that evaluation will occur for all the communications
in the "select" statement. in the "select" statement.
</p> </p>
<p> <p>
If the channel sends or receives an interface type, its
communication can proceed only if the type of the communication
clause matches that of the dynamic value to be exchanged.
</p>
<p>
If multiple cases can proceed, a uniform fair choice is made to decide If multiple cases can proceed, a uniform fair choice is made to decide
which single communication will execute. which single communication will execute.
<p> <p>
@ -3646,7 +3641,7 @@ string(0x65e5) // "\u65e5"
bytes are those of the array/slice. bytes are those of the array/slice.
<pre> <pre>
string([]byte('h', 'e', 'l', 'l', 'o')) // "hello" string([]byte{'h', 'e', 'l', 'l', 'o'}) // "hello"
</pre> </pre>
</li> </li>
</ul> </ul>
@ -4141,8 +4136,6 @@ cap() does not work on maps or chans.
<br/> <br/>
len() does not work on chans. len() does not work on chans.
<br/> <br/>
select doesn't check dynamic type of interfaces.
<br/>
Conversions work for any type; doc says only arithmetic types and strings. Conversions work for any type; doc says only arithmetic types and strings.
</font> </font>
</p> </p>