aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2010-12-02 12:32:14 -0800
committerRobert Griesemer <gri@golang.org>2010-12-02 12:32:14 -0800
commit777a96a5b09f00bf531a75d9d65251e1771f05ed (patch)
treede4da7568e82cd983b88408fe03d54d41a63589b
parentb88b38ac12ef6d10fe15f2b03a9a1d8559f4b038 (diff)
downloadgo-777a96a5b09f00bf531a75d9d65251e1771f05ed.tar.gz
go-777a96a5b09f00bf531a75d9d65251e1771f05ed.zip
go_spec: fixed a couple omissions/type errors
- use math.Sqrt instead of Math.sqrt - use float64 for Point fields to match math.Sqrt - distinguish between Point and Point3D for clarity - add alignment sizes for complex types R=r, rsc, iant, ken2 CC=golang-dev https://golang.org/cl/3420041
-rw-r--r--doc/go_spec.html39
1 files changed, 20 insertions, 19 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 2b2817d9cb..e7c5d13636 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,5 +1,5 @@
<!-- title The Go Programming Language Specification -->
-<!-- subtitle Version of Nov 4, 2010 -->
+<!-- subtitle Version of December 2, 2010 -->
<!--
TODO
@@ -1661,7 +1661,7 @@ TypeSpec = identifier Type .
type IntArray [16]int
type (
- Point struct { x, y float }
+ Point struct { x, y float64 }
Polar Point
)
@@ -1878,13 +1878,13 @@ Given type <code>Point</code>, the declarations
</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>
@@ -1906,7 +1906,7 @@ argument. For instance, the method <code>Scale</code> has type
</p>
<pre>
-func(p *Point, factor float)
+func(p *Point, factor float64)
</pre>
<p>
@@ -2025,8 +2025,8 @@ For struct literals the following rules apply:
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>
@@ -2034,8 +2034,8 @@ one may write
</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>
@@ -2058,7 +2058,7 @@ Taking the address of a composite literal (§<a href="#Address_operators">Addres
generates a unique pointer to an instance of the literal's value.
</p>
<pre>
-var pointer *Point = &amp;Point{y: 1000}
+var pointer *Point3D = &amp;Point3D{y: 1000}
</pre>
<p>
@@ -2210,7 +2210,7 @@ Point{1, 2}
m["foo"]
s[i : j + 1]
obj.color
-Math.sin
+math.Sin
f.p[i].x()
</pre>
@@ -5199,12 +5199,13 @@ For the numeric types (§<a href="#Numeric_types">Numeric types</a>), the follow
</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>