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
* レミリア・スカーレット [200427 12:46]:
> Why you need to write a "func sum(a, b int) int {...}", not "sum(a, b int)
> int {...}"?
> It seems to me that one could do without func keyword.
I believe another reason is that the Go language designers decided that
every top-level syntax element begins with a k
Why you need to write a "func sum(a, b int) int {...}", not "sum(a, b int)
int {...}"?
It seems to me that one could do without func keyword.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving email