4 ms·
Could use a better title... it's the golang.org's blog, and it's an explanation of the syntax, which is not really implied by "Go's declaration syntax". With j
by Groxx 16y ago
Could use a better title... it's the golang.org's blog, and it's an explanation of the syntax, which is not really implied by "Go's declaration syntax". With just the domain and title, I'd assumed this was just documentation (as sometimes gets posted on hn), not discussion, and skipped over it several times.
All in all interesting, and I definitely agree with the improvement with their "function-returning function which accepts a function as an argument" example. An interesting departure from C & languages influenced by C (ie: most).
- derefr 16y agoIndeed. C-style declarations have always been intuitionally-opaque to me (I've always had to concentrate on them to get what they're saying), but the Go example: f func(func(int,int) int, int) func(int, int) int is a simple mechanical transformation away from being a Haskell declaration: f :: ((Int, Int) -> Int, Int) -> (Int, Int) -> Int
- kaib 16y ago> "function-returning function which accepts a function as an argument" I write almost exclusively Go day to day and I've noticed I no longer shy away from function pointers like in C. It's not that the C version can't be mastered, it's just that I'd rather not occupy a significant chunk of my brain with it. Another interesting observation is that I can now pretty easily switch between C and Go if I need to, the declaration syntax seems different enough that my brain can do the leap. Sadly less true for semicolons (Go omits most, C doesn't)
- Groxx 16y ago-1? seriously? What's objectionable about this?