diff options
Diffstat (limited to 'doc/go_spec.html')
-rw-r--r-- | doc/go_spec.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index fd5fee46eb..22b616134a 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ <!--{ "Title": "The Go Programming Language Specification", - "Subtitle": "Version of Jul 26, 2021", + "Subtitle": "Version of Aug 23, 2021", "Path": "/ref/spec" }--> @@ -3000,6 +3000,18 @@ method value; the saved copy is then used as the receiver in any calls, which may be executed later. </p> +<pre> +type S struct { *T } +type T int +func (t T) M() { print(t) } + +t := new(T) +s := S{T: t} +f := t.M // receiver *t is evaluated and stored in f +g := s.M // receiver *(s.T) is evaluated and stored in g +*t = 42 // does not affect stored receivers in f and g +</pre> + <p> The type <code>T</code> may be an interface or non-interface type. </p> |