Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Incorrect. Thank you.

CoPilot is helpless if it needs to do more than just regurgitate someone else's code.

The training of these models on GitHub, so they regurgitate licensed code without attribution, is the greatest theft of intellectual property in the history of Man. Perhaps not according to the letter of the law, but surely according to the spirit.



I like CoPilot's answer better than yours, and I think it's closer to what most people would do; clearly 0x3F is the wrong constant but the approach is good.


I like the manual solution better: it includes thought process without negative impact on readability or performance.

This makes it easier to match the code against the specification, something a random (and in this case even wrong) magic number fails to do.

But maybe I'm overthinking it.


You're not overthinking it.

You're correct.


CoPilot's solution is totally wrong. Sorry.

CoPilot regurgitated somebody's solution... to a different problem. It's pathetic.


Here's my solution (I'm a human):

    func set6(x uint64) uint64 {
       return x | 0x7E0000000
    }
Is this also pathetic?


A good solution! You SOLVED the problem.

CoPilot got it WRONG. You got it RIGHT.

You UNDERSTAND the problem but CoPilot does NOT.

Is that clear?


For fun I rephrased the prompt a little. "Middle bits" is kind of vague; when provided an explicit description of which bits you want to set it does fine:

Prompt:

  // Function to set bits 29-34 in a uint64 to 1
  func setbits (uint64 x) uint64 {
Completion:

    return x | (1 << 29) | (1 << 30) | (1 << 31) | (1 << 32) | (1 << 33) | (1 << 34)
  }
It would be nice if it made a better guess about what "middle" is supposed to mean here, of course.


Middle bits is not ambiguous, but CoPilot hasn't seen code for that phrase in its training so it has nothing to regurgitate.

You spelled out exactly what to do, in term of what it has seen in its training, and it was able to regurgitate a solution.

By asking question that require mathematical reasoning or are too far from the training corpus, I can create an endless list of simple problems that CoPilot can't solve.

Look at my comment history to see another one (swapping bits).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: