Live data from Hacker News

Copilot regurgitating Quake code, including sweary comments

twitter.com

301–310 of 672 posts

Re: Copilot regurgitating Quake code, including sweary comments

#301
post #279
post #273

Earlier quoted context omitted.

> It's not a problem with "non-modern" languages, it's a problem with C and many of its successors. Not really. Any semi-decent modern language allows the creation of custom types which support the desired behavior and often some syntactic sugar (like operator overloading) to make their usage more natural. Take C++, for example, the archetypal "C successor": It's almost trivial to define a class which stores a fixed-…

It is also trivial to keep doing C mistakes with a C++ compiler, hence no matter how many ISO revisions it will still have, lack of safety due to C copy-paste compatibility will never be fixed.

> [...] no matter how many ISO revisions it will still have, lack of safety due to C copy-paste compatibility will never be fixed.

Okay, no idea how that's relevant to "built-in decimal types" vs "library-defined decimal types", but if it makes you feel better, you can do the same in Rust or Python, two languages which are "modern" compared to COBOL, don't inherit C's flaws, and which enable defining custom number types/classes/whatever together with convenient operator overloading.

Re: Copilot regurgitating Quake code, including sweary comments

#302
post #263

Earlier quoted context omitted.

Copilot appears to be “give more efficiency leverage to the worst kind of coder.”

Hmm... I mean, these all seem like mistakes I could make and I don't think I'm the "worst kind of coder". The currency one I learned a while back, but it's not like I intuited using integers by default. Value being a reserved keyword, I'm not sure I'd know that and I do Postgres work as part of my myriad duties at the startup I work at. Maybe I'd make that mistake in a migration, maybe I have already. In a way, is it…

Is this any worse? Maybe not. Is it better? Absolutely not.

This kind of tool will only further entrench the production of mediocre, bug-ridden code that plagues the world. As implemented, this will not be a solution; it is a express lane in the race to the bottom.

Re: Copilot regurgitating Quake code, including sweary comments

#303
post #36

Earlier quoted context omitted.

Isn't it entirely possible that they did exclude GPL licensed code, but somebody somewhere has violated copyright and copy-pasted that snippet into non-GPL-licensed code that they trained on? They could try to trace every single code snippet they train on to its "true source" and use the license for that, but that's not very well-defined, and is a lot harder, and it's never going to be 100%.

Nope. They did include GPL code. > Once, GitHub Copilot suggested starting an empty file with something it had even seen more than a whopping 700,000 different times during training -- that was the GNU General Public License. https://docs.github.com/en/github/copilot/research-recitatio...

Looks like Copilot is smart enough to understand its own licensing situation. It should continue to suggest this for any empty file.

Re: Copilot regurgitating Quake code, including sweary comments

#304
post #30

They have 4 hand picked examples on their homepage: https://copilot.github.com/ One has the issue with form encoding: https://news.ycombinator.com/item?id=27697884 The python example is using floats for currency, in an expense tracking context. The golang one uses a word ("value") for a field name that's been a reserved word since SQL-1999. It will work in popular open source SQL databases, but I believe it would bom…

I haven't seen anyone mention this issue for some reason, but in fetch_tweets.py:

  fetch_tweets_from_user(user_name):
      ...
      tweets = api.user_timeline(screen_name=user, count=200, include_rts=False)  
'user' isn't defined, should be user_name, right? Side note, 'copilot' is a decent name for this (though copilots are usually very competent, moreso than this right now). You must check the suggestions carefully. Maybe it'll make folks better at code review, lol.

Re: Copilot regurgitating Quake code, including sweary comments

#305
post #301
post #279

Earlier quoted context omitted.

It is also trivial to keep doing C mistakes with a C++ compiler, hence no matter how many ISO revisions it will still have, lack of safety due to C copy-paste compatibility will never be fixed.

> [...] no matter how many ISO revisions it will still have, lack of safety due to C copy-paste compatibility will never be fixed. Okay, no idea how that's relevant to "built-in decimal types" vs "library-defined decimal types", but if it makes you feel better, you can do the same in Rust or Python, two languages which are "modern" compared to COBOL, don't inherit C's flaws, and which enable defining custom number ty…

[deleted]

Re: Copilot regurgitating Quake code, including sweary comments

#306
This reminds me of an issue that came up when I was working with a intelligence agency, training machine translation.

If you think about language in general, individual words aren't very sensitive. The word for bomb in any language is public knowledge. But when you start getting to jargony phrases, some might be unique to an organization. And if you're training your MT on translated documents surreptitiously intercepted from West Nordistan's nuclear program, and make your MT model public, the West Nordistanis might notice - "hey, this accurately translates our non-public documents that contain rather novel phrases ... I think someone's been listening to us!"

Re: Copilot regurgitating Quake code, including sweary comments

#307
post #261

Earlier quoted context omitted.

> The python example is using floats for currency. Dumb question, but what is the proper way to handle currency? Custom number objects? Strings for any number of decimal places?

An integer of the smallest denomination. For example, cents for the American dollar. And you probably would want to wrap it in a custom type to simplify displaying it properly, and maybe handle different currencies. If you language has a fixed point type that might also be appropriate, but that's pretty rare, and wouldn't work for currencies that aren't decimal (like the old british pound system).

What if I'm calculating sales tax? Can't use an integer anymore.

Re: Copilot regurgitating Quake code, including sweary comments

#308

Earlier quoted context omitted.

Copilot appears to be “give more efficiency leverage to the worst kind of coder.”

It takes what should be your method of last resort - copypaste - and makes it the first thing you try. All the steps in between - looking at the docstring for the function you're calling, googling for more general information, looking at and deciding not to use not-applicable or poorly-written SO answers - get pushed aside. So instead of you having to convince yourself "yes, it's safe to copy-paste these lines from S…

Thinking about it more: there's a very small subset of problems that I think this is actually great for. And I do run into this somewhat often: relatively new libraries or frameworks that don't really care about thorough documentation so they only show you a few happy path snippets and nothing about how to do something more interesting, so you have to bridge the gap between "this one line in the doc obviously doesn't work with me, but I'd like to figure it out without reading all their source code from scratch..." - getting more example snippets barfed up onto my screen from other people who've figured it out before could be a sort of replacement for the library writers having provided documentation in the first place. But ... this is a somewhat insane way to work around a problem of shitty code documentation, and is still insufficient in a couple ways:

* some poor bastard is going to have to be the first person to figure out how to do something, so that copilot itself can know

* any non-code nuances around "oh, if you do that, your memory usage is going to explode" or "oh, by the way, if you do that, make sure you don't do your own threading" will still fail to be communicated.

Re: Copilot regurgitating Quake code, including sweary comments

#309

Earlier quoted context omitted.

Honestly I’ve automated a large chunk of my day job. The trick is keeping it secret!

Well... wait until all the programmer salaries crash to minimum wage because Management believe that "CoPilot does most of the work anyway".

Then wait for them to realize how brittle the code is when nobody is considering the context into which this code is being foisted. They'll TRIPLE our salaries! :D

Re: Copilot regurgitating Quake code, including sweary comments

#310
post #30

They have 4 hand picked examples on their homepage: https://copilot.github.com/ One has the issue with form encoding: https://news.ycombinator.com/item?id=27697884 The python example is using floats for currency, in an expense tracking context. The golang one uses a word ("value") for a field name that's been a reserved word since SQL-1999. It will work in popular open source SQL databases, but I believe it would bom…

> The python example is using floats for currency. Dumb question, but what is the proper way to handle currency? Custom number objects? Strings for any number of decimal places?

> Dumb question, but what is the proper way to handle currency?

In python, for exact applications (not many kinds of modeling, where floats are probably right), decimal.Decimal is usually the right answer, but fractions.Fraction is sometimes more appropriate, and if you are using NumPy or tools dependent on it, using integers (representing decimals multiplied by the right power of 10 to get the minimum unit in the ones position) is probably better.

Post reply on HN