10 ms·
Fortunately, we now have Copilot to write it. I'm not kidding. Go is at a very nice verbosity level as far as reading code goes, but writing it is indeed tedio
by cube2222 4y ago
Fortunately, we now have Copilot to write it.
I'm not kidding. Go is at a very nice verbosity level as far as reading code goes, but writing it is indeed tedious occasionally. However, in practice, Copilot is able to handle those bits extremely well, giving us the best of both worlds.
- LAC-Tech 4y agoBut what the code reviewers - aren't they the real victims?
- sanderjd 4y agoHow does it do if I need to change one small thing in every copy of the code I generated? (Edit: This is a serious question; I recently semi-seriously commented that maybe solutions like Copilot are particularly well suited to solve this problem with Go, so I'm curious how well it works in practice.)
- erik_seaberg 4y agoIt should always be regenerated as a compilation target, never maintained by developers made of meat.
- sanderjd 4y agoWhat should? Are we talking about the same thing? My understanding of the Copilot workflow is that you use it as a programmer to "write" code by accepting suggestions and then checking the suggested code in as if you had written it the normal way.
- erik_seaberg 4y agoI mean when a language requires as much repetitive boilerplate as this one, replacing the suggestion with some kind of markup to generate it will pay off almost immediately.
- cube2222 4y agoI think we're talking about different kinds of code generation. I'm mostly talking about boilerplate like writing `if err != nil` with a nice wrapping message every other line. Copilot will just write 2-3 lines at a time. That's imo the kind of boilerplate that might often be annoying to write. I'm not talking about generating multiple copies of the same function nor anything like that. That would be better suited to deterministic generation or copy+paste. Copilot doesn't help you here.
- sanderjd 4y agoOk that makes sense. You don't need something as powerful as Copilot for that kind of boilerplate though, there have been "snippets" / macro things for that for forever. My bigger annoyance is when I want to write non-trivial functionality that works for different data types.
- cube2222 4y ago> You don't need something as powerful as Copilot for that kind of boilerplate though, there have been "snippets" / macro things for that for forever. I'm not aware of anything else that writes good wrapping error messages automatically though. Your use-case is precisely what you'd be using generics / standard codegen for.
- sanderjd 4y agoInteresting, it's the error messages themselves that it's good for, rather than the boilerplate; I assumed you just meant the boilerplate around the error message. That kind of surprises me, but I guess I shouldn't be shocked that people are handling the same errors with the same messages over and over again without any way to encapsulate the pattern. Not shocked I guess, but that is disappointing.
- cube2222 4y agoThat's the point, it's not the same messages. Each error wrap has a situation-dependent wrapping message, different for each wrapped error in the function. Copilot is great at writing the whole `if err != nil`, including context-specific wrapping messages. It's also great at writing your code in many other situations where the intent is clear and simple, but it just takes a few lines to write in Go. I'm not sure if you've ever used Copilot yourself, but it's basically autocomplete on steroids.