forked from golang/go
-
Notifications
You must be signed in to change notification settings - Fork 0
Rationales
Andrew Gerrand edited this page Dec 10, 2014
·
1 revision
This wiki entry will try to document the rationales behind some important language decisions besides what's included in the Go FAQ and Effective Go.
Reference: https://groups.google.com/forum/#!topic/golang-nuts/aqTwXHaSC_Y
Go doesn't allow receiver's base type to be pointer to avoid possible ambiguity. Suppose you have:
type T blah
type P *T
func (t *T) String() string { ... }
func (p P) String() string { ... }
var p P
Then the meaning of the expression (*p).String()
is ambiguous, because it can refer to
both (*T).String
and P.String
.
Go doesn't allow receiver's base type to be interfaces, because interfaces already have methods. (TODO)
- Home
- Getting started with Go
- Working with Go
- Learning more about Go
- The Go Community
- Using the Go toolchain
- Additional Go Programming Wikis
- Online Services that work with Go
- Troubleshooting Go Programs in Production
- Contributing to the Go Project
- Platform Specific Information
- Release Specific Information