From fe53795422f3ae9ee242b2565f7e20968918f076 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 20 Aug 2009 10:47:40 -0700 Subject: [PATCH] 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 --- doc/go_spec.html | 52 +++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index df8f7b0a9a4..0f7d6cc6bb4 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -3791,14 +3791,14 @@ for i := 0; i <= 3; i++ {
 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)
-          []T, *[]T            slice length
-          map[K]T, *map[K]T    map length
+          []T                  slice length
+          map[K]T              map length
           chan T               number of elements in channel buffer
 
-cap(s)    []T, *[]T            capacity of s
-          map[K]T, *map[K]T    capacity of s
+cap(s)    [n]T, *[n]T          array length (== n)
+          []T                  slice capacity
           chan T               channel buffer capacity
 
@@ -3962,6 +3962,7 @@ buffered channels:
 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
 m := make(map[string] int, 100);  # map with initial space for 100 elements
 
@@ -4060,25 +4061,12 @@ import "lib/math" math.Sin import . "lib/math" Sin -

Multi-file packages

+

Multiple-file packages

-TODO: Update for whole-package compilation. -

- -

-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. -

- -

-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. +If a package is constructed from multiple source files, +all names declared in the package block, not just uppercase ones, +are in scope in all the files in the package.

@@ -4093,19 +4081,9 @@ function Sin(x float) float { return ... }

-and file "math2.go" begins -

-
-package math
-
-import "lib/math"
-
- -

-then, provided "math1.go" is compiled first and -installed in "lib/math", math2.go -may refer directly to Sin and twoPi -without a qualified identifier. +then a second file math2.go also in +package math +may refer directly to Sin and twoPi.

An example package

@@ -4366,11 +4344,9 @@ The following minimal alignment properties are guaranteed:

Differences between this doc and implementation - TODO

-Implementation accepts only ASCII digits for digits; doc says Unicode. -
Implementation does not honor the restriction on goto statements and targets (no intervening declarations).
-cap() does not work on maps or chans. +cap() does not work on chans.
len() does not work on chans.