<!-- title The Go Programming Language Specification -->
-<!-- subtitle Version of Nov 4, 2010 -->
+<!-- subtitle Version of December 2, 2010 -->
<!--
TODO
type IntArray [16]int
type (
- Point struct { x, y float }
+ Point struct { x, y float64 }
Polar Point
)
</p>
<pre>
-func (p *Point) Length() float {
- return Math.sqrt(p.x * p.x + p.y * p.y)
+func (p *Point) Length() float64 {
+ return math.Sqrt(p.x * p.x + p.y * p.y)
}
-func (p *Point) Scale(factor float) {
- p.x = p.x * factor
- p.y = p.y * factor
+func (p *Point) Scale(factor float64) {
+ p.x *= factor
+ p.y *= factor
}
</pre>
</p>
<pre>
-func(p *Point, factor float)
+func(p *Point, factor float64)
</pre>
<p>
Given the declarations
</p>
<pre>
-type Point struct { x, y, z float }
-type Line struct { p, q Point }
+type Point3D struct { x, y, z float64 }
+type Line struct { p, q Point3D }
</pre>
<p>
</p>
<pre>
-origin := Point{} // zero value for Point
-line := Line{origin, Point{y: -4, z: 12.3}} // zero value for line.q.x
+origin := Point3D{} // zero value for Point3D
+line := Line{origin, Point3D{y: -4, z: 12.3}} // zero value for line.q.x
</pre>
<p>
generates a unique pointer to an instance of the literal's value.
</p>
<pre>
-var pointer *Point = &Point{y: 1000}
+var pointer *Point3D = &Point3D{y: 1000}
</pre>
<p>
m["foo"]
s[i : j + 1]
obj.color
-Math.sin
+math.Sin
f.p[i].x()
</pre>
</p>
<pre class="grammar">
-type size in bytes
+type size in bytes
-byte, uint8, int8 1
-uint16, int16 2
-uint32, int32, float32 4
-uint64, int64, float64 8
+byte, uint8, int8 1
+uint16, int16 2
+uint32, int32, float32 4
+uint64, int64, float64, complex64 8
+complex128 16
</pre>
<p>