blob: 165db084a6e45f8f5e75815bbeb0a980f7607ab2 [file] [log] [blame] [view]
Andrew Gerrand5bc444d2014-12-10 11:35:11 +11001# Introduction
2
3This wiki entry will try to document the rationales behind some important language
4decisions besides what's included in the Go FAQ and Effective Go.
5
6# Language Features
7### Why method receiver's base type cannot be pointer or interface?
8Reference: https://groups.google.com/forum/#!topic/golang-nuts/aqTwXHaSC_Y
9
10Go doesn't allow receiver's base type to be pointer to avoid possible ambiguity.
11Suppose you have:
12```
13type T blah
14type P *T
15
16func (t *T) String() string { ... }
17func (p P) String() string { ... }
18
19var p P
20```
21
22Then the meaning of the expression ` (*p).String() ` is ambiguous, because it can refer to
23both ` (*T).String ` and ` P.String `.
24
25Go doesn't allow receiver's base type to be interfaces, because interfaces already have methods. (TODO)
26
Alexey Palazhchenkoc2d2e152017-01-25 19:35:18 +030027### Select with closed channel
28
29[Issue #11344](https://github.com/golang/go/issues/11344).
30
31### Send to closed channel
32
33[Issue #18511](https://github.com/golang/go/issues/18511).
34
Andrew Gerrand5bc444d2014-12-10 11:35:11 +110035# Memory Model
36
37# Standard Library