mirror of
https://github.com/golang/go
synced 2024-11-22 02:34:40 -07:00
clean up multifile package section.
remove ASCII digit comment that isn't true. R=gri DELTA=41 (1 added, 25 deleted, 15 changed) OCL=33594 CL=33596
This commit is contained in:
parent
16b95ba614
commit
fe53795422
@ -3791,14 +3791,14 @@ for i := 0; i <= 3; i++ {
|
|||||||
<pre class="grammar">
|
<pre class="grammar">
|
||||||
Call Argument type Result
|
Call Argument type Result
|
||||||
|
|
||||||
len(s) string, *string string length (in bytes)
|
len(s) string string length (in bytes)
|
||||||
[n]T, *[n]T array length (== n)
|
[n]T, *[n]T array length (== n)
|
||||||
[]T, *[]T slice length
|
[]T slice length
|
||||||
map[K]T, *map[K]T map length
|
map[K]T map length
|
||||||
chan T number of elements in channel buffer
|
chan T number of elements in channel buffer
|
||||||
|
|
||||||
cap(s) []T, *[]T capacity of s
|
cap(s) [n]T, *[n]T array length (== n)
|
||||||
map[K]T, *map[K]T capacity of s
|
[]T slice capacity
|
||||||
chan T channel buffer capacity
|
chan T channel buffer capacity
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -3962,6 +3962,7 @@ buffered channels:
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
s := make([]int, 10, 100); # slice with len(s) == 10, cap(s) == 100
|
s := make([]int, 10, 100); # slice with len(s) == 10, cap(s) == 100
|
||||||
|
s := make([]int, 10); # slice with len(s) == cap(s) == 10
|
||||||
c := make(chan int, 10); # channel with a buffer size of 10
|
c := make(chan int, 10); # channel with a buffer size of 10
|
||||||
m := make(map[string] int, 100); # map with initial space for 100 elements
|
m := make(map[string] int, 100); # map with initial space for 100 elements
|
||||||
</pre>
|
</pre>
|
||||||
@ -4060,25 +4061,12 @@ import "lib/math" math.Sin
|
|||||||
import . "lib/math" Sin
|
import . "lib/math" Sin
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3>Multi-file packages</h3>
|
<h3>Multiple-file packages</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
TODO: Update for whole-package compilation.
|
If a package is constructed from multiple source files,
|
||||||
</p>
|
all names declared in the package block, not just uppercase ones,
|
||||||
|
are in scope in all the files in the package.
|
||||||
<p>
|
|
||||||
If a package is constructed from multiple source files, all names
|
|
||||||
at package-level scope, not just exported names, are visible to all the
|
|
||||||
files in the package. An import declaration is still necessary to
|
|
||||||
declare intention to use the names,
|
|
||||||
but the imported names do not need a qualified identifer to be
|
|
||||||
accessed.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
The compilation of a multi-file package may require
|
|
||||||
that the files be compiled and installed in an order that satisfies
|
|
||||||
the resolution of names imported within the package.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -4093,19 +4081,9 @@ function Sin(x float) float { return ... }
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
and file <code>"math2.go"</code> begins
|
then a second file <code>math2.go</code> also in
|
||||||
</p>
|
<code>package math</code>
|
||||||
<pre>
|
may refer directly to <code>Sin</code> and <code>twoPi</code>.
|
||||||
package math
|
|
||||||
|
|
||||||
import "lib/math"
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
then, provided <code>"math1.go"</code> is compiled first and
|
|
||||||
installed in <code>"lib/math"</code>, <code>math2.go</code>
|
|
||||||
may refer directly to <code>Sin</code> and <code>twoPi</code>
|
|
||||||
without a qualified identifier.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>An example package</h3>
|
<h3>An example package</h3>
|
||||||
@ -4366,11 +4344,9 @@ The following minimal alignment properties are guaranteed:
|
|||||||
<h2><font color=red>Differences between this doc and implementation - TODO</font></h2>
|
<h2><font color=red>Differences between this doc and implementation - TODO</font></h2>
|
||||||
<p>
|
<p>
|
||||||
<font color=red>
|
<font color=red>
|
||||||
Implementation accepts only ASCII digits for digits; doc says Unicode.
|
|
||||||
<br/>
|
|
||||||
Implementation does not honor the restriction on goto statements and targets (no intervening declarations).
|
Implementation does not honor the restriction on goto statements and targets (no intervening declarations).
|
||||||
<br/>
|
<br/>
|
||||||
cap() does not work on maps or chans.
|
cap() does not work on chans.
|
||||||
<br/>
|
<br/>
|
||||||
len() does not work on chans.
|
len() does not work on chans.
|
||||||
</font>
|
</font>
|
||||||
|
Loading…
Reference in New Issue
Block a user