mirror of
https://github.com/golang/go
synced 2024-11-21 22:24:40 -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:
parent
ccd026486a
commit
acf4dd4d56
@ -308,12 +308,12 @@ which is a clear, concise name.
|
|||||||
Moreover,
|
Moreover,
|
||||||
because imported entities are always addressed with their package name, <code>bufio.Reader</code>
|
because imported entities are always addressed with their package name, <code>bufio.Reader</code>
|
||||||
does not conflict with <code>io.Reader</code>.
|
does not conflict with <code>io.Reader</code>.
|
||||||
Similarly, the function to make new instances of <code>vector.Vector</code>—which
|
Similarly, the function to make new instances of <code>ring.Ring</code>—which
|
||||||
is the definition of a <em>constructor</em> in Go—would
|
is the definition of a <em>constructor</em> in Go—would
|
||||||
normally be called <code>NewVector</code>, but since
|
normally be called <code>NewRing</code>, but since
|
||||||
<code>Vector</code> is the only type exported by the package, and since the
|
<code>Ring</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>.
|
package is called <code>ring</code>, it's called just <code>New</code>.
|
||||||
Clients of the package see that as <code>vector.New</code>.
|
Clients of the package see that as <code>ring.New</code>.
|
||||||
Use the package structure to help you choose good names.
|
Use the package structure to help you choose good names.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user