aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-10-06 10:46:18 -0700
committerRob Pike <r@golang.org>2011-10-06 10:46:18 -0700
commit029c9bcb8bbf4b9dd55293d9b41fc1c16994b3f9 (patch)
treeb8de9bb3bd434cd245b2c0e0c931752d40d50632
parent417c42218f486b443099be2b283dc9cc56c8f858 (diff)
downloadgo-029c9bcb8bbf4b9dd55293d9b41fc1c16994b3f9.tar.gz
go-029c9bcb8bbf4b9dd55293d9b41fc1c16994b3f9.zip
Effective Go: IntArray -> IntSlice
Fixes #2336. R=golang-dev, dsymonds, rsc CC=golang-dev https://golang.org/cl/5222042
-rw-r--r--doc/effective_go.html10
-rw-r--r--doc/effective_go.tmpl10
2 files changed, 10 insertions, 10 deletions
diff --git a/doc/effective_go.html b/doc/effective_go.html
index 6adf7e5558..60e569b138 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -1871,7 +1871,7 @@ do create a new value.)
It's an idiom in Go programs to convert the
type of an expression to access a different
set of methods. As an example, we could use the existing
-type <code>sort.IntArray</code> to reduce the entire example
+type <code>sort.IntSlice</code> to reduce the entire example
to this:
</p>
<pre>
@@ -1879,14 +1879,14 @@ type Sequence []int
// Method for printing - sorts the elements before printing
func (s Sequence) String() string {
- sort.IntArray(s).Sort()
+ sort.IntSlice(s).Sort()
return fmt.Sprint([]int(s))
}
</pre>
<p>
Now, instead of having <code>Sequence</code> implement multiple
interfaces (sorting and printing), we're using the ability of a data item to be
-converted to multiple types (<code>Sequence</code>, <code>sort.IntArray</code>
+converted to multiple types (<code>Sequence</code>, <code>sort.IntSlice</code>
and <code>[]int</code>), each of which does some part of the job.
That's more unusual in practice but can be effective.
</p>
@@ -2081,8 +2081,8 @@ func ArgServer(w http.ResponseWriter, req *http.Request) {
<p>
<code>ArgServer</code> now has same signature as <code>HandlerFunc</code>,
so it can be converted to that type to access its methods,
-just as we converted <code>Sequence</code> to <code>IntArray</code>
-to access <code>IntArray.Sort</code>.
+just as we converted <code>Sequence</code> to <code>IntSlice</code>
+to access <code>IntSlice.Sort</code>.
The code to set it up is concise:
</p>
<pre>
diff --git a/doc/effective_go.tmpl b/doc/effective_go.tmpl
index 46d774ad4e..da827368b1 100644
--- a/doc/effective_go.tmpl
+++ b/doc/effective_go.tmpl
@@ -1809,7 +1809,7 @@ do create a new value.)
It's an idiom in Go programs to convert the
type of an expression to access a different
set of methods. As an example, we could use the existing
-type <code>sort.IntArray</code> to reduce the entire example
+type <code>sort.IntSlice</code> to reduce the entire example
to this:
</p>
<pre>
@@ -1817,14 +1817,14 @@ type Sequence []int
// Method for printing - sorts the elements before printing
func (s Sequence) String() string {
- sort.IntArray(s).Sort()
+ sort.IntSlice(s).Sort()
return fmt.Sprint([]int(s))
}
</pre>
<p>
Now, instead of having <code>Sequence</code> implement multiple
interfaces (sorting and printing), we're using the ability of a data item to be
-converted to multiple types (<code>Sequence</code>, <code>sort.IntArray</code>
+converted to multiple types (<code>Sequence</code>, <code>sort.IntSlice</code>
and <code>[]int</code>), each of which does some part of the job.
That's more unusual in practice but can be effective.
</p>
@@ -2019,8 +2019,8 @@ func ArgServer(w http.ResponseWriter, req *http.Request) {
<p>
<code>ArgServer</code> now has same signature as <code>HandlerFunc</code>,
so it can be converted to that type to access its methods,
-just as we converted <code>Sequence</code> to <code>IntArray</code>
-to access <code>IntArray.Sort</code>.
+just as we converted <code>Sequence</code> to <code>IntSlice</code>
+to access <code>IntSlice.Sort</code>.
The code to set it up is concise:
</p>
<pre>