diff --git a/doc/go_spec.html b/doc/go_spec.html index afb85de02b..1f0b520904 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -362,7 +362,7 @@ A sequence of string literals is concatenated to form a single string. StringLit = string_lit { string_lit } . string_lit = raw_string_lit | interpreted_string_lit . raw_string_lit = "`" { unicode_char } "`" . -interpreted_string_lit = """ { unicode_value | byte_value } """ . +interpreted_string_lit = `"` { unicode_value | byte_value } `"` .
@@ -490,6 +490,7 @@ The method set of the corresponding pointer type*Tis the set of all methods with receiver*TorT(that is, it also contains the method set ofT). Any other type has an empty method set. +In a method set, each method must have a unique name.The static type (or just type) of a variable is the @@ -855,7 +856,7 @@ func (n int) (func (p* T))
Interface types
-An interface type specifies a method set called its interface. +An interface type specifies a method set called its interface. A variable of interface type can store a value of any type with a method set that is any superset of the interface. Such a type is said to implement the interface. An interface value may be
nil. @@ -864,10 +865,15 @@ that is any superset of the interface. Such a type is said toInterfaceType = "interface" "{" [ MethodSpecList ] "}" . MethodSpecList = MethodSpec { ";" MethodSpec } [ ";" ] . -MethodSpec = identifier Signature | InterfaceTypeName . +MethodSpec = MethodName Signature | InterfaceTypeName . +MethodName = identifier . InterfaceTypeName = TypeName .++As with all method sets, in an interface type, each method must have a unique name. +
+// A simple File interface interface { @@ -935,8 +941,7 @@ as theFileinterface.An interface may contain an interface type name
@@ -1766,7 +1771,6 @@ which is a function with a receiver.Tin place of a method specification. -In this notation,Tmust denote a different interface type -and the effect is equivalent to enumerating the methods ofTexplicitly +The effect is equivalent to enumerating the methods ofTexplicitly in the interface.MethodDecl = "func" Receiver MethodName Signature [ Body ] . Receiver = "(" [ identifier ] [ "*" ] BaseTypeName ")" . -MethodName = identifier . BaseTypeName = identifier .@@ -3010,55 +3014,73 @@ Conversion = LiteralType "(" Expression ")" .-The following conversion rules apply: +In general, a conversion succeeds if the value of
-xis +assignment compatible with typeT, +or if the value would be assignment compatible with typeTif the +value's type, orT, or any of their component types were unnamed. +Usually, such a conversion changes the type but not the representation of the value +ofxand thus has no run-time cost.
T.
-T if the value's type, or T, or any of their component
-types were unnamed.
-
+Specific rules apply to conversions where T is a numeric or string type.
+These conversions may change the representation of a value and incur a run-time cost.
+
+If the value is a signed quantity, it is
sign extended to implicit infinite precision; otherwise it is zero
extended. It is then truncated to fit in the result type's size.
For example, if x := uint16(0x10F0), then uint32(int8(x)) == 0xFFFFFFF0.
The conversion always yields a valid value; there is no indication of overflow.
-
x of type float32
+may be stored using additional precision beyond that of an IEEE-754 32-bit number,
+but float32(x) represents the result of rounding x's value to
+32-bit precision. Similarly, x + 0.1 may use more than 32 bits
+of precision, but float32(x + 0.1) does not.
+In all conversions involving floating-point values, if the result type cannot +represent the value the conversion succeeds but the result value is +implementation-dependent. +
+ +string(0x65e5) // "\u65e5" == "日" == "\xe6\x97\xa5"-
nil, the result is the empty string.
-string([]int{0x767d, 0x9d6c, 0x7fd4}) // "\u767d\u9d6c\u7fd4" == "白鵬翔"
+string([]int{0x767d, 0x9d6c, 0x7fd4}) // "\u767d\u9d6c\u7fd4" == "白鵬翔"
+
nil,
the result is the empty string.
@@ -3066,7 +3088,7 @@ the result is the empty string.
string([]byte{'h', 'e', 'l', 'l', 'o'}) // "hello"
There is no linguistic mechanism to convert between pointers and integers. @@ -3152,7 +3174,15 @@ overflow etc. errors being caught. When evaluating the elements of an assignment or expression, all function calls, method calls and communication operations are evaluated in lexical left-to-right -order. Otherwise, the order of evaluation is unspecified. +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.
@@ -4132,7 +4162,7 @@ guaranteed to stay in the language. They do not return a result.
-Call Behavior +Function Behavior print prints all arguments; formatting of arguments is implementation-specific println like print but prints spaces between arguments and a newline at the end