My stance on (GitHub) Copilot

I saw Brodie Robertson's video about NetBSD banning AI generated code on YouTube and I wanted to share my thoughts on the topic.

Youtube video: Brodie Robertson - NetBSD Completely Bans AI Generated Code

I think current AI generated code is fine. Here's why. For simple cases, like printing "Hello, World!" 10 times or centering a div, the code has shown up many, many times on the internet that is more then likely not even copyright-able. And for complicated code. No senior developers asks copilot to generate some code and leave it there. In most cases, people is going to use Copilot as a very powerful autocomplete to reduce their mental load. And in the end, they are able to write that code themselves. Just copilot made it far easier beyond the help of language servers and other autocomplete tools. Remember people use VIM because it lets you type at the speed of your thoughts? Copilot is the same thing. But instead of typing, it guesses your thought and the user accepts the solution if it happens to generate the right thing.

Take one example in my workflow. I need a C++ function that returns a std::optional<size_t>. Where the value is only set if the string can be fully parsed. What I would do with copilot is

// What I write
static std::optional<size_t> stosz(const std::string &str)

// What gets generated
        size_t idx = 0;
        size_t res = std::stoull(str, &idx);
        if (idx != str.size())
            return std::nullopt;
        return res;
    catch (const std::exception &)
        return std::nullopt;

This function might be considered non-trivial. Also, writing it is easy AF for me. I know exacatly what std::stoull does from my more then 12 years of writing C++. But even at my best, typing it takes like.. 15 seconds. While copilot takes less then 5.

For those worried about the copilot reducing programmer's skill. Copilot needs you to provide it a sensable context. Just telling it to "Build a video display window using SDL" doesn't work. You still need to provide is with the function declerations, variables and what not for it to ever generate anything useful. Sure, there are shortcuts that you can take if the code is already written hundreds of times on the internet. If that's the case, just DuckDuckGo it and copy-and-paste it from stackoverflow. When did we started to care about that violating copyright?

Your opinion might differ. But I don't think it makes any sense to ban an advanced autocomplete engine. Just like running a language server or GNU Tags on forgien projects doesn't contaminate your codebase.

Author's profile. Photo taken in VRChat by my friend Tast+
Martin Chang
Systems software, HPC, GPGPU and AI. I mostly write stupid C++ code. Sometimes does AI research. Chronic VRChat addict

I run TLGS, a major search engine on Gemini. Used by Buran by default.

  • marty1885 \at
  • Matrix:
  • Jami: a72b62ac04a958ca57739247aa1ed4fe0d11d2df