If context is not given, I can't tell if foo.Bar() is a function of package 
foo or a method of variable foo.
That is, dot is used both for package namespace and method call.

Example:

type T struct {
}

func (t T) Println(s string) {
fmt.Println("method: " + s)
}

func main() {
fmt.Println("hello from package function")
fmt := T{}
fmt.Println("hello")
}

https://play.golang.org/p/HZibMmJ8W5

I wonder if such an ambiguity came into Go...
1) on purpose, since the dot (.) is easy on the eye and simple key stroke 
(shift not needed) ?
2) by accident, since keyboards lack convenient alternate symbols ?
3) for other reasons ?

Everton

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to