|
1 | 1 | <!--{
|
2 | 2 | "Title": "The Go Programming Language Specification",
|
3 |
| - "Subtitle": "Version of November 4, 2016", |
| 3 | + "Subtitle": "Version of November 18, 2016", |
4 | 4 | "Path": "/ref/spec"
|
5 | 5 | }-->
|
6 | 6 |
|
@@ -2006,7 +2006,7 @@ <h3 id="Short_variable_declarations">Short variable declarations</h3>
|
2006 | 2006 | <p>
|
2007 | 2007 | Unlike regular variable declarations, a short variable declaration may <i>redeclare</i>
|
2008 | 2008 | variables provided they were originally declared earlier in the same block
|
2009 |
| -(or the parameter lists if the block is the function body) with the same type, |
| 2009 | +(or the parameter lists if the block is the function body) with the same type, |
2010 | 2010 | and at least one of the non-<a href="#Blank_identifier">blank</a> variables is new.
|
2011 | 2011 | As a consequence, redeclaration can only appear in a multi-variable short declaration.
|
2012 | 2012 | Redeclaration does not introduce a new variable; it just assigns a new value to the original.
|
@@ -2352,10 +2352,11 @@ <h3 id="Composite_literals">Composite literals</h3>
|
2352 | 2352 | [][]int{{1, 2, 3}, {4, 5}} // same as [][]int{[]int{1, 2, 3}, []int{4, 5}}
|
2353 | 2353 | [][]Point{{{0, 1}, {1, 2}}} // same as [][]Point{[]Point{Point{0, 1}, Point{1, 2}}}
|
2354 | 2354 | map[string]Point{"orig": {0, 0}} // same as map[string]Point{"orig": Point{0, 0}}
|
2355 |
| - |
2356 |
| -[...]*Point{{1.5, -3.5}, {0, 0}} // same as [...]*Point{&Point{1.5, -3.5}, &Point{0, 0}} |
2357 |
| - |
2358 | 2355 | map[Point]string{{0, 0}: "orig"} // same as map[Point]string{Point{0, 0}: "orig"}
|
| 2356 | + |
| 2357 | +type PPoint *Point |
| 2358 | +[2]*Point{{1.5, -3.5}, {}} // same as [2]*Point{&Point{1.5, -3.5}, &Point{}} |
| 2359 | +[2]PPoint{{1.5, -3.5}, {}} // same as [2]PPoint{PPoint(&Point{1.5, -3.5}), PPoint(&Point{})} |
2359 | 2360 | </pre>
|
2360 | 2361 |
|
2361 | 2362 | <p>
|
|
0 commit comments