]> Cypherpunks repositories - gostls13.git/commitdiff
complete types
authorRob Pike <r@golang.org>
Wed, 25 Feb 2009 01:47:45 +0000 (17:47 -0800)
committerRob Pike <r@golang.org>
Wed, 25 Feb 2009 01:47:45 +0000 (17:47 -0800)
R=gri
DELTA=29  (0 added, 12 deleted, 17 changed)
OCL=25388
CL=25391

doc/go_spec.html

index fa239b5e833bc102de0a965e21e35cc582739b48..9f44543c18986d23a89cbc5f6543b3ea0dac7c30 100644 (file)
@@ -555,22 +555,14 @@ including arrays, structs, pointers, functions, interfaces, slices, maps, and
 channels.
 </p>
 
-<p>
-TODO: not sure the rest of this section this is needed; it's all covered or should be covered in the sections
-that follow.
-</p>
 <p>
 At any point in the source code, a type may be <i>complete</i> or
-<i>incomplete</i>.  Most types are always complete, although their
-components, such as the base type of a pointer type, may be incomplete.
-Struct and interface types are incomplete when forward declared
-(§Forward declarations) and become complete once they are fully
-declared.  (TODO: You had array here - why?)
-The type of a variable must be complete where the variable is declared.
-(TODO: would be better to say what you CAN do with an interface type,
-and then drop all the references to complete types in the sections
-that follow.  What can you do? Use one to declare a pointer variable/field/param.
-Anything else?)
+<i>incomplete</i>.  An incomplete type is one whose size is not
+yet known, such as a struct whose fields are not yet fully
+defined or a forward declared type (§Forward declarations).
+Most types are always complete; for instance, a pointer
+type is always complete even if it points to an incomplete type
+because the size of the pointer itself is always known.
 </p>
 <p>
 The <i>interface</i> of a type is the set of methods bound to it
@@ -669,11 +661,10 @@ can be computed by the function <code>len(s1)</code>.
 </p>
 
 <p>
-String literals separated only by the empty string, white
-space, or comments are concatenated into a single string literal.
+A sequence of string literals is concatenated into a single string.
 </p>
 <pre class="grammar">
-StringLit              = string_lit { string_lit } .
+StringLit   = string_lit { string_lit } .
 </pre>
 
 <h3>Array types</h3>
@@ -686,7 +677,7 @@ negative.
 </p>
 
 <pre class="grammar">
-ArrayType = "[" ArrayLength "]" ElementType .
+ArrayType   = "[" ArrayLength "]" ElementType .
 ArrayLength = Expression .
 ElementType = CompleteType .
 </pre>
@@ -783,7 +774,7 @@ but are otherwise ignored.
 
 <pre>
 // A struct corresponding to the EventIdMessage protocol buffer.
-// The tag strings contain the protocol buffer field numbers.
+// The tag strings define the protocol buffer field numbers.
 struct {
        time_usec uint64 "field 1";
        server_ip uint32 "field 2";
@@ -810,9 +801,7 @@ map[string] chan
 </pre>
 
 <p>
-To permit construction of recursive and mutually recursive types,
-the pointer base type may be denoted by the type name of a
-forward-declared, incomplete type (§Forward declarations).
+The pointer base type may be an incomplete type (§Types).
 </p>
 
 <h3>Function types</h3>
@@ -919,7 +908,7 @@ func (p T) Unlock() { ... }
 they implement the Lock interface as well as the File interface.
 <p>
 An interface may contain a type name T in place of a method specification.
-T must denote another, complete (and not forward-declared) interface type.
+T must denote another, complete interface type.
 Using this notation is equivalent to enumerating the methods of T explicitly
 in the interface containing T.
 
@@ -1087,7 +1076,7 @@ of the map.
 
 A channel provides a mechanism for two concurrently executing functions
 to synchronize execution and exchange values of a specified type. This
-type must be a complete type (§Types). <font color=red>(TODO could it be incomplete?)</font>
+type must be a complete type (§Types).
 
 <pre class="grammar">
 ChannelType = Channel | SendChannel | RecvChannel .
@@ -1249,7 +1238,6 @@ TODO in another round of editing:
 It may make sense to have a special section in this doc containing these rule
 sets for:
 
-complete/incomplete types
 equality of types
 identity of types
 comparisons
@@ -1593,7 +1581,7 @@ type Comparable interface {
 <p>
 A variable declaration creates a variable, binds an identifier to it and
 gives it a type and optionally an initial value.
-The variable type must be a complete type (§Types).
+The type must be complete (§Types).
 </p>
 <pre class="grammar">
 VarDecl     = "var" ( VarSpec | "(" [ VarSpecList ] ")" ) .
@@ -3776,7 +3764,7 @@ a <code>Pointer</code> and vice versa.
 </p>
 <p>
 The function <code>Sizeof</code> takes an expression denoting a
-variable of any type and returns the size of the variable in bytes.
+variable of any (complete) type and returns the size of the variable in bytes.
 </p>
 <p>
 The function <code>Offsetof</code> takes a selector (§Selectors) denoting a struct