diff --git a/doc/go_spec.html b/doc/go_spec.html index fc3fbaf30a6..0fd50534172 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -78,7 +78,8 @@ The form a ... b represents the set of characters from

Source code representation

-Source code is Unicode text encoded in UTF-8. The text is not +Source code is Unicode text encoded in +UTF-8. The text is not canonicalized, so a single accented code point is distinct from the same character constructed from combining an accent and a letter; those are treated as two code points. For simplicity, this document @@ -101,7 +102,7 @@ unicode_digit = /* a Unicode code point classified as "Digit" */ .

-In The Unicode Standard 5.1, +In The Unicode Standard 5.2, Section 4.5 General Category-Normative defines a set of character categories. Go treats those characters in category Lu, Ll, Lt, Lm, or Lo as Unicode letters, @@ -347,8 +348,8 @@ quotes "". The text between the quotes, which may not span multiple lines, forms the value of the literal, with backslash escapes interpreted as they are in character literals (except that \' is illegal and -\" is legal). The three-digit octal (\000) -and two-digit hexadecimal (\x00) escapes represent individual +\" is legal). The three-digit octal (\nnn) +and two-digit hexadecimal (\xnn) escapes represent individual bytes of the resulting string; all other escapes represent the (possibly multi-byte) UTF-8 encoding of individual characters. Thus inside a string literal \377 and \xFF represent @@ -359,7 +360,7 @@ U+00FF.

-A sequence of string literals is concatenated to form a single string. +A sequence of string literals is concatenated to form a single string constant.

@@ -428,8 +429,7 @@ The boolean truth values are represented by the predeclared constants
 

-Numeric constants represent values of arbitrary precision that -have no size and cannot overflow. +Numeric constants represent values of arbitrary precision and do not overflow.

@@ -447,7 +447,7 @@ or conversion, or implicitly when used in a operand in an expression. It is an error if the constant value cannot be accurately represented as a value of the respective type. -For instance, 3.0 can be given any integer type but also any +For instance, 3.0 can be given any integer or any floating-point type, while 2147483648.0 (equal to 1<<31) can be given the types float32, float64, or uint32 but not int32 or string. @@ -539,9 +539,8 @@ byte familiar alias for uint8

-Integer types are represented in the usual binary format; the value of -an n-bit integer is n bits wide. A negative signed integer is represented -as the two's complement of its absolute value. +The value of an n-bit integer is n bits wide and represented using +two's complement arithmetic.

@@ -601,7 +600,7 @@ ElementType = Type .

-The length is part of the array's type and must must be a +The length is part of the array's type and must be a constant expression that evaluates to a non-negative integer value. The length of array a can be discovered using the built-in function len(a), which is a @@ -1061,7 +1060,7 @@ chan<- float // can only be used to send floats

The value of an uninitialized channel is nil. A new, initialized channel -value is made using the built-in function make, +value can be made using the built-in function make, which takes the channel type and an optional capacity as arguments:

@@ -1520,7 +1519,7 @@ const (

Iota

-Within a constant declaration, the predeclared pseudo-constant +Within a constant declaration, the predeclared identifier iota represents successive untyped integer constants. It is reset to 0 whenever the reserved word const appears in the source and increments with each semicolon. It can be used to construct a @@ -1780,8 +1779,8 @@ func flushICache(begin, end uintptr) // implemented externally

Method declarations

-A method declaration binds an identifier to a method, -which is a function with a receiver. +A method is a function with a receiver. +A method declaration binds an identifier to a method.

 MethodDecl   = "func" Receiver MethodName Signature [ Body ] .
@@ -1822,7 +1821,7 @@ to the base type Point.
 

-If the receiver's value is not referenced inside the the body of the method, +If the receiver's value is not referenced inside the body of the method, its identifier may be omitted in the declaration. The same applies in general to parameters of functions and methods.

@@ -2391,7 +2390,8 @@ with the same element type as the array.

Type assertions

-For an expression x and a type T, the primary expression +For an expression x of interface type +and a type T, the primary expression

@@ -2399,10 +2399,9 @@ x.(T)
 

-asserts that x is not the zero interface value +asserts that x is not nil and that the value stored in x is of type T. The notation x.(T) is called a type assertion. -The type of x must be an interface type.

More precisely, if T is not an interface type, x.(T) asserts @@ -2463,7 +2462,7 @@ the method.

-Atan2(x, y)    // function call
+math.Atan2(x, y)    // function call
 var pt *Point;
 pt.Scale(3.5)  // method call with receiver pt
 
@@ -2738,7 +2737,7 @@ as if the left operand is shifted n times by 1 for a shift count of n. As a result, x << 1 is the same as x*2 and x >> 1 is the same as -x/2 truncated towards negative infinity. +x/2 but truncated towards negative infinity.

@@ -3201,11 +3200,11 @@ of the constant type. The following constant expressions are illegal:

-uint(-1)       // -1 overflows uint
-int(3.14)      // 3.14 truncated to integer
-int64(Huge)    // 1<<100 overflows int64
-Four * 300     // 300 overflows int8
-Four * 100     // 400 overflows int8
+uint(-1)       // -1 cannot be represented as a uint
+int(3.14)      // 3.14 cannot be represented as an int
+int64(Huge)    // 1<<100 cannot be represented as an int64
+Four * 300     // 300 cannot be represented as an int8
+Four * 100     // 400 cannot be represented as an int8
 

@@ -3304,7 +3303,7 @@ EmptyStmt = .

-A statement list can always in effect be terminated with a semicolon by +A statement list can always be terminated with a semicolon, in effect adding an empty statement.

@@ -3525,7 +3524,7 @@ If no case matches and there is a "default" case, its statements are executed. There can be at most one default case and it may appear anywhere in the "switch" statement. -A missing expression is equivalent to +A missing switch expression is equivalent to the expression true.

@@ -3556,12 +3555,12 @@ case 0, 1, 2, 3: s1() case 4, 5, 6, 7: s2() } -switch x := f(); { +switch x := f(); { // missing switch expression means "true" case x < 0: return -x default: return x } -switch { // missing expression means "true" +switch { case x < y: f1(); case x < z: f2(); case x == 4: f3(); @@ -3604,15 +3603,14 @@ is a nil interface value.

-Given a function f that returns -a value of type interface{}, +Given an expression x of type interface{}, the following type switch:

-switch i := f().(type) {
+switch i := x.(type) {
 case nil:
-	printString("f() returns nil");
+	printString("x is nil");
 case int:
 	printInt(i);  // i is an int
 case float:
@@ -3631,9 +3629,9 @@ could be rewritten:
 

-v := f();
+v := x;  // x is evaluated exactly once
 if v == nil {
-	printString("f() returns nil");
+	printString("x is nil");
 } else if i, is_int := v.(int); is_int {
 	printInt(i);  // i is an int
 } else if i, is_float := v.(float); is_float {
@@ -4129,12 +4127,12 @@ The implementation guarantees that the result always fits into an int