Yeah, I agree with Marvin. "func" is also needed for anonymous functions and defining function types. This would be quite weird (and probably not easily parseable):
add := (a, b int) int { return a+b } type adder (a, b int) int Most importantly for me, explicit syntax for this allows me to easily use simple tools like grep or Ctrl-F to find function definitions -- I can just do a text-search for "func Foo". In C and other languages that's hard, you have to search for "{startOfLine}{returnType} Foo". But without regex search it's hard to search for startOfLine, and often you don't know the returnType. I believe another reason is that the Go language designers decided that > every top-level syntax element begins with a keyword: package, import, > type, const, var, func. Perhaps this is just for convenience of > parsing, but it greatly simplifies human parsing (readability) as well. > > ...Marvin > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1e20ab54-6738-4547-a51b-c55241685181%40googlegroups.com.