Not sure how to feel about that. Those new styles certainly look cleaner but I reflexively dislike introducing new ways to do the same thing. (Though I do think try was ok.)
Edit: On second thought, the arrow style looks really weird. I think if an anonymous struct has to have the word struct, then an anonymous function should have the word func.
On second thought, the arrow style looks really weird. I think if an anonymous struct has to have the word struct, then an anonymous function should have the word func.
I’m used to the fat arrow from JavaScript. In the abstract, I agree that it would be better to reuse the func keyword, but given that to make it work grammatically, they would have to drop the parentheses, which makes things look misgrouped, I think all things equal, the fat arrow is the lesser of two evil.
I don’t think the juice is worth the squeeze. Idiomatic go leans heavily on synchronous functions communicating via channels. Callbacks are mercifully rare compared to other languages.
This seems neat; verbose callbacks have been a bit tedious (surprised this doesn’t get more flak from the people who think Go’s error handling is a major ordeal).
Probably the most controversial bit is the lack of types on the parameter values. I’ve had a pretty poor experience with languages that do a lot of type inference because it becomes tedious to know what type a thing is (or returns) without really good tooling, and it seems like it makes it really hard to get good error messages. Requiring “really good tooling” has historically winnowed the field quite a lot–historically we’ve had to choose between editors that have really good support for inference but piss-poor keybindings (or other features). Hopefully language servers will fix (or “have fixed”?) this so we only need to solve for inference in the language server rather than in each editor.
Hopefully language servers will fix (or “have fixed”?)
For most popular languages (and some less popular ones) it does seem like it’s fixed. I install a language server through my package manager, open a file in a project, and now I have diagnostics, docs, type-directed autocomplete, all of that stuff, in my keyboard-oriented TUI editor.
Not sure how to feel about that. Those new styles certainly look cleaner but I reflexively dislike introducing new ways to do the same thing. (Though I do think
try
was ok.)Edit: On second thought, the arrow style looks really weird. I think if an anonymous struct has to have the word
struct
, then an anonymous function should have the wordfunc
.I’m used to the fat arrow from JavaScript. In the abstract, I agree that it would be better to reuse the func keyword, but given that to make it work grammatically, they would have to drop the parentheses, which makes things look misgrouped, I think all things equal, the fat arrow is the lesser of two evil.
I don’t think the juice is worth the squeeze. Idiomatic go leans heavily on synchronous functions communicating via channels. Callbacks are mercifully rare compared to other languages.
It’s not worth the inconsistency in the language.
This seems neat; verbose callbacks have been a bit tedious (surprised this doesn’t get more flak from the people who think Go’s error handling is a major ordeal).
Probably the most controversial bit is the lack of types on the parameter values. I’ve had a pretty poor experience with languages that do a lot of type inference because it becomes tedious to know what type a thing is (or returns) without really good tooling, and it seems like it makes it really hard to get good error messages. Requiring “really good tooling” has historically winnowed the field quite a lot–historically we’ve had to choose between editors that have really good support for inference but piss-poor keybindings (or other features). Hopefully language servers will fix (or “have fixed”?) this so we only need to solve for inference in the language server rather than in each editor.
For most popular languages (and some less popular ones) it does seem like it’s fixed. I install a language server through my package manager, open a file in a project, and now I have diagnostics, docs, type-directed autocomplete, all of that stuff, in my keyboard-oriented TUI editor.