I gotta say, I've seen worse code come out of humans. I especially appreciate the comments. TL;DR: ChatGPT won't put programmers out of business anytime soon, but it should raise the bar a bit.
Also is it intentionally clever that it doesn't check for 0 length usernames, and then checks that it has a character, or did it just get lucky?
More interestingly if I ask about reddit it uses a more compact/clever regex, and provides usage information for the function it creates:
ChatGPT is really clever in some ways, e.g. it figured out mailchannels API, but also dumb in that the mailchannels API doesn't need an API key for sending. TL;DR: if you know how to ask the question correctly, and have some idea of what the output should be, ChatGPT will be helpful. And as time goes on I can only assume it will get better.
@kurtseifried Right, but "can it regurgitate code that works" nor even "can it regurgitate code that's not bad" aren't very meaningful questions if it can't collaborate. Writing "new" code is only one of a developer's skills.
@vathpela I think more interestingly, right now ChatGPT handles low value work pretty well, so a decent programmer can now make ChatGPT regurgitate simple code blocks quickly, work that might be done by entry-level people. I'd be more concerned about "what will junior devs do", and I suspect the answer is "they'll have to level up" much like sysadmins had to now that tools are expected to be used. No more hand-crafted servers plz and thanks.
@kurtseifried I don't think junior programming jobs work the way you think they work. If they do, I never had one. But I'm not sure; that may be the case.