diff options
| author | Robert Griesemer <gri@golang.org> | 2008-12-18 13:29:11 -0800 |
|---|---|---|
| committer | Robert Griesemer <gri@golang.org> | 2008-12-18 13:29:11 -0800 |
| commit | 6ccca61510ac3e3a9e96019bc6bfb1286cac080e (patch) | |
| tree | ce6c508c571268857cf8fd1c220ae1749ce6755d | |
| parent | ab0d2582b475751ef0f81adff13e616067250b1b (diff) | |
| download | go-6ccca61510ac3e3a9e96019bc6bfb1286cac080e.tar.xz | |
- receiver ident may be optional
R=r
DELTA=5 (2 added, 0 deleted, 3 changed)
OCL=21508
CL=21510
| -rw-r--r-- | doc/go_spec.txt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/doc/go_spec.txt b/doc/go_spec.txt index d3fd4714ed..a3af04af3a 100644 --- a/doc/go_spec.txt +++ b/doc/go_spec.txt @@ -3,7 +3,7 @@ The Go Programming Language Specification (DRAFT) Robert Griesemer, Rob Pike, Ken Thompson -(December 17, 2008) +(December 18, 2008) ---- @@ -3045,10 +3045,12 @@ as a type name, or as a pointer to a type name. The type specified by the type name is called ``receiver base type''. The receiver base type must be a type declared in the current file, and it must not be a pointer type. The method is said to be ``bound'' to the receiver base type; specifically -it is declared within the scope of that type (§Type declarations). +it is declared within the scope of that type (§Type declarations). If the +receiver value is not needed inside the method, its identifier may be omitted +in the declaration. MethodDecl = "func" Receiver identifier FunctionType [ Block ] . - Receiver = "(" identifier [ "*" ] TypeName ")" . + Receiver = "(" [ identifier ] [ "*" ] TypeName ")" . All methods bound to a receiver base type must have the same receiver type: Either all receiver types are pointers to the base type or they are the base |
