]> Cypherpunks repositories - gostls13.git/commitdiff
&Foo{x,y} wasn't in the spec. This gets it in, dependent on a proper section regarding
authorRob Pike <r@golang.org>
Thu, 19 Mar 2009 05:58:36 +0000 (22:58 -0700)
committerRob Pike <r@golang.org>
Thu, 19 Mar 2009 05:58:36 +0000 (22:58 -0700)
address operators, to follow.

R=rsc
DELTA=11  (10 added, 0 deleted, 1 changed)
OCL=26529
CL=26532

doc/go_spec.html

index 2da598cf86b8d3c6eb10e92fc192213ed99689b1..06d5f4f68c6b8e12ada2fee2bb9e5a7fbc8e660a 100644 (file)
@@ -1906,7 +1906,17 @@ one may write
 </p>
 
 <pre>
-pi := Num{Rat{22, 7}, 3.14159, "pi"};
+pi := Num{Rat{22, 7}, 3.14159, "pi"}
+</pre>
+
+<p>
+Since evaluation of a literal creates a new value, taking the address of a
+composite literal (§Address operators) generates a pointer to a unique
+instance of the literal's value.
+</p>
+
+<pre>
+var pi_ptr *Rat = &amp;Rat{22, 7}
 </pre>
 
 <p>