1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:47:58 -07:00

change the naming example from Vector to Ring due to loss of vector.New()

R=rsc
CC=golang-dev
https://golang.org/cl/164082
This commit is contained in:
Rob Pike 2009-12-02 13:46:02 -08:00
parent ccd026486a
commit acf4dd4d56

View File

@ -308,12 +308,12 @@ which is a clear, concise name.
Moreover,
because imported entities are always addressed with their package name, <code>bufio.Reader</code>
does not conflict with <code>io.Reader</code>.
Similarly, the function to make new instances of <code>vector.Vector</code>&mdash;which
Similarly, the function to make new instances of <code>ring.Ring</code>&mdash;which
is the definition of a <em>constructor</em> in Go&mdash;would
normally be called <code>NewVector</code>, but since
<code>Vector</code> is the only type exported by the package, and since the
package is called <code>vector</code>, it's called just <code>New</code>.
Clients of the package see that as <code>vector.New</code>.
normally be called <code>NewRing</code>, but since
<code>Ring</code> is the only type exported by the package, and since the
package is called <code>ring</code>, it's called just <code>New</code>.
Clients of the package see that as <code>ring.New</code>.
Use the package structure to help you choose good names.
</p>