From: Robert Griesemer *T
is the set of all methods with receiver *T
or T
(that is, it also contains the method set of T
).
Any other type has an empty method set.
-In a method set, each method must have a unique method name.
+In a method set, each method must have a
+unique method name.
@@ -895,7 +896,7 @@ A struct is a sequence of named elements, called fields, each of which has a name and a type. Field names may be specified explicitly (IdentifierList) or implicitly (AnonymousField). Within a struct, non-blank field names must -be unique. +be unique.
@@ -1074,7 +1075,8 @@ InterfaceTypeName = TypeName .
-As with all method sets, in an interface type, each method must have a unique name. +As with all method sets, in an interface type, each method must have a +unique name.
@@ -1538,10 +1540,19 @@ the body of any nested function. +Blank identifier
+ ++The blank identifier, represented by the underscore character
+ +_
, may be used in a declaration like +any other identifier but the declaration does not introduce a new binding. +Predeclared identifiers
-The following identifiers are implicitly declared in the universe block: +The following identifiers are implicitly declared in the +universe block:
Types: @@ -1564,28 +1575,31 @@ Functions:Exported identifiers
-An identifier may be exported to permit access to it from another package -using a qualified identifier. An identifier -is exported if both: +An identifier may be exported to permit access to it from another package. +An identifier is exported if both:
-
- the first character of the identifier's name is a Unicode upper case letter (Unicode class "Lu"); and
-- the identifier is declared in the package block or denotes a field or method of a type - declared in that block.
+- the first character of the identifier's name is a Unicode upper case + letter (Unicode class "Lu"); and
+- the identifier is declared in the package block + or it is a field name or + method name.
All other identifiers are not exported.
-Blank identifier
+Uniqueness of identifiers
-The blank identifier, represented by the underscore character
-_
, may be used in a declaration like -any other identifier but the declaration does not introduce a new binding. +Given a set of identifiers, an identifier is called unique if it is +different from every other in the set. +Two identifiers are different if they are spelled differently, or if they +appear in different packages and are not +exported. Otherwise, they are the same.Constant declarations
@@ -1942,7 +1956,7 @@ is visible only within selectors for that type.
For a base type, the non-blank names of -methods bound to it must be unique. +methods bound to it must be unique. If the base type is a struct type, the non-blank method and field names must be distinct.
@@ -2022,12 +2036,12 @@ QualifiedIdent = [ PackageName "." ] identifier .A qualified identifier accesses an identifier in a different package, which must be imported. -The identifier must be exported by that -package, which means that it must begin with a Unicode upper case letter. +The identifier must be exported and +declared in the package block of that package.
-math.Sin +math.Sin // denotes the Sin function in package mathComposite literals
@@ -2332,8 +2346,8 @@ whereT
is not an interface type,x.f
denotes the field or method at the shallowest depth inT
where there is such anf
. -If there is not exactly onef
with shallowest depth, the selector -expression is illegal. +If there is not exactly onef
+with shallowest depth, the selector expression is illegal.
x
of type I
@@ -5070,11 +5084,12 @@ An implementation may require that all source files for a package inhabit the sa
-An import declaration states that the source file containing the -declaration uses identifiers -exported by the imported -package and enables access to them. The import names an -identifier (PackageName) to be used for access and an ImportPath +An import declaration states that the source file containing the declaration +depends on functionality of the imported package +(§Program initialization and execution) +and it enables access to exported identifiers +of that package. +The import names an identifier (PackageName) to be used for access and an ImportPath that specifies the package to be imported.
@@ -5086,13 +5101,14 @@ ImportPath = string_lit .
The PackageName is used in qualified identifiers
-to access the exported identifiers of the package within the importing source file.
+to access exported identifiers of the package within the importing source file.
It is declared in the file block.
If the PackageName is omitted, it defaults to the identifier specified in the
package clause of the imported package.
If an explicit period (.
) appears instead of a name, all the
-package's exported identifiers will be declared in the current file's
-file block and can be accessed without a qualifier.
+package's exported identifiers declared in that package's
+package block will be declared in the importing source
+file's file block and can be accessed without a qualifier.