News for hackers. Stuff that matters.
Re:GitHub Copilot available for JetBrains and Neovim by foepys on Wednesday October 27, 2021 @03:41PM (#29018117)
Redis has the INCR command that does this in redis without the additional round-trips (and race conditions). It also sets the value to 0 if the key doesn't exist.

So, I actually consider this to be exactly the bad behavior that people accuse Copilot of.

Re:GitHub Copilot available for JetBrains and Neovim by speedgoose on Wednesday October 27, 2021 @04:03PM (#29018399)
Yes it's not very shinning there. I would also throw the error instead of printing the error to the console and returning undefined.
Re:GitHub Copilot available for JetBrains and Neovim by ponyous on Wednesday October 27, 2021 @06:12PM (#29019740)
You are in a callback there. Goodbye your error!
Re:GitHub Copilot available for JetBrains and Neovim by speedgoose on Thursday October 28, 2021 @03:34AM (#29023415)
Oh right. I once made a layer on top of the redis client to use promises because callbacks are a pain to deal with.
Re:GitHub Copilot available for JetBrains and Neovim by gfosco on Wednesday October 27, 2021 @03:56PM (#29018323)
This was just one of its suggestions, but you're right of course.. it's all based on the training data and idioms used there. If it doesn't weight more modern code higher, if it's not aware of new versions and methods, it isn't going to be super intelligent.. but it can still give you some ideas.