diff --git a/doc/go_spec.html b/doc/go_spec.html
index c1b817ee9b..5860eec7f0 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -137,7 +137,9 @@ through the character sequence */
. Comments do not nest.
Tokens form the vocabulary of the Go language.
There are four classes: identifiers, keywords, operators
and delimiters, and literals. White space, formed from
-blanks, tabs, and newlines, is ignored except as it separates tokens
+spaces (U+0020), horizontal tabs (U+0009),
+carriage returns (U+000D), and newlines (U+000A),
+is ignored except as it separates tokens
that would otherwise combine into a single token. Comments
behave as white space. While breaking the input into tokens,
the next token is the longest sequence of characters that form a
@@ -295,7 +297,7 @@ After a backslash, certain single-character escapes represent special values:
\" U+0022 double quote (valid escape only within string literals)
-All other sequences are illegal inside character literals. +All other sequences starting with a backslash are illegal inside character literals.
char_lit = "'" ( unicode_value | byte_value ) "'" . @@ -341,7 +343,8 @@ span multiple lines.Interpreted string literals are character sequences between double -quotes
""
. The text between the quotes forms the +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
) @@ -445,9 +448,9 @@ 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 -floating-point type, while-1e12
can be given the types -float32
,float64
, or evenint64
but -notuint64
orstring
. +floating-point type, while2147483648.0
(equal to1<<31
) +can be given the typesfloat32
,float64
, oruint32
but +notint32
orstring
.@@ -832,7 +835,7 @@ must either all be present or all be absent. If present, each name stands for one item (parameter or result) of the specified type; if absent, each type stands for one item of that type. Parameter and result lists are always parenthesized except that if there is exactly -one unnamed result that is not a function type it may writen as an unparenthesized type. +one unnamed result that is not a function type it may written as an unparenthesized type.
For the last parameter only, instead of a type one may write @@ -1176,7 +1179,7 @@ they have different field names.
A value
v
of static typeV
is assignment compatible -with a typeT
if one of the following conditions applies: +with a typeT
if one or more of the following conditions applies:
nil
, if it is uninitialized, or if it has
been assigned another slice value equal to nil
·
nil
if it has
+An interface value is equal to nil
if it has
been assigned the explicit value nil
, if it is uninitialized,
or if it has been assigned another interface value equal to nil
.
@@ -1770,8 +1773,8 @@ A method declaration binds an identifier to a method, which is a function with a receiver.
-MethodDecl = "func" Receiver MethodName Signature [ Body ] . -Receiver = "(" [ identifier ] [ "*" ] BaseTypeName ")" . +MethodDecl = "func" Receiver MethodName Signature [ Body ] . +Receiver = "(" [ identifier ] [ "*" ] BaseTypeName ")" . BaseTypeName = identifier .@@ -2420,7 +2423,7 @@ f(a1, a2, ... an)
calls f
with arguments a1, a2, ... an
.
-The arguments must be single-valued expressions
+Except for one special case, arguments must be single-valued expressions
assignment compatible with the parameter types of
F
and are evaluated before the function is called.
The type of the expression is the result type
@@ -2436,6 +2439,33 @@ var pt *Point;
pt.Scale(3.5) // method call with receiver pt
+
+As a special case, if the return parameters of a function or method
+g
are equal in number and individually assignment
+compatible with the parameters of another function or method
+f
, then the call f(g(parameters_of_g))
+will invoke f
after binding the return values of
+g
to the parameters of f
in order. The call
+of f
must contain no parameters other than the call of g
.
+If f
has a final ...
parameter, it is
+assigned the return values of g
that remain after
+assignment of regular parameters.
+
+func Split(s string, pos int) (string, string) { + return s[0:pos], s[pos:len(s)] +} + +func Join(s, t string) string { + return s + t +} + +if Join(Split(value, len(value)/2)) != value { + log.Fatal("test fails") +} ++
A method call x.m()
is valid if the method set of
(the type of) x
contains m
and the
@@ -3179,14 +3209,6 @@ communication operations are evaluated in lexical left-to-right
order.
-Floating-point operations within a single expression are evaluated according to
-the associativity of the operators. Explicit parentheses affect the evaluation
-by overriding the default associativity.
-In the expression x + (y + z)
the addition y + z
-is performed before adding x
.
-
For example, in the assignment
@@ -3202,6 +3224,14 @@ and indexing ofx
and the evaluation
of y
is not specified.
+
+Floating-point operations within a single expression are evaluated according to
+the associativity of the operators. Explicit parentheses affect the evaluation
+by overriding the default associativity.
+In the expression x + (y + z)
the addition y + z
+is performed before adding x
.
+
@@ -3316,7 +3346,7 @@ assign_op = [ add_op | mul_op ] "=" .
Each left-hand side operand must be addressable, -a map index expresssion, +a map index expression, or the blank identifier.
@@ -3331,7 +3361,7 @@ k = <-ch An assignment operationx
op=
y
where op is a binary arithmetic operation is equivalent
to x
=
x
op
-y
but evalutates x
+y
but evaluates x
only once. The op=
construct is a single token.
In assignment operations, both the left- and right-hand expression lists
must contain exactly one single-valued expression.
@@ -3727,7 +3757,7 @@ for i, s := range a {
}
var key string;
-var val interface {}; // value type of m is assignment compatible to val
+var val interface {}; // value type of m is assignment compatible with val
for key, val = range m {
h(key, val)
}
@@ -4397,10 +4427,11 @@ package-level function with the name and signature of
func init()
-defined in its source. Since a package may contain more
-than one source file, there may be more than one
-init()
function in a package, but
-only one per source file.
+defined in its source.
+A package may contain multiple
+init()
functions, even
+within a single source file; they execute
+in unspecified order.
Within a package, package-level variables are initialized,
@@ -4459,7 +4490,8 @@ Program execution begins by initializing the main
package and then
invoking main.main()
.
-When main.main()
returns, the program exits.
+When main.main()
returns, the program exits. It does not wait for
+other (non-main
) goroutines to complete.
Implementation restriction: The compiler assumes package main
@@ -4583,4 +4615,5 @@ The following minimal alignment properties are guaranteed: