You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gc lets this bad code compile:
http://play.golang.org/p/kCI2Ha6G2U
package main
import "bufio"
func (r *bufio.Reader) Buffered() int { return -1 }
func main() {
}
If you change "Buffered" to some method that doesn't already exist, you get
the proper error message:
http://play.golang.org/p/HQnj7B8fIt
package main
import "bufio"
func (r *bufio.Reader) MonkeyPatch() int { return -1 }
func main() {
}
prog.go:5: cannot define new methods on non-local type bufio.Reader
gccgo doesn't have the problem.
Props to pabuhr for finding this (which led him to believe that Go does allow monkey
patching)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: