dummzeuch 1505 Posted January 29, 2023 (edited) I just spent some time testing ChatGPTs ability to "understand" and explain Delphi source code. The results were actually quite good. I asked ChatGPT "what’s wrong with the following Delphi code?" function IsoStringToDateTime(const ISODateTime: string): TDateTime; const ISOShortLen = 19; ISOFullLen = 23; var y, m, d, h, n, s, z: Word; begin // ISODateTime should be in one of these formats: // YYYY-MM-DDTHH:NN:SS, YYYY-MM-DD HH:NN:SS // YYYY-MM-DDTHH:NN:SS.ZZZ, YYYY-MM-DD HH:NN:SS.ZZZ if (Length(ISODateTime) <> ISOShortLen) and (Length(ISODateTime) <> ISOFullLen) then raise EConvertError.Create('Invalid ISO date time string: ' + ISODateTime); y := SysUtils.StrToInt(Copy(ISODateTime, 1, 4)); m := SysUtils.StrToInt(Copy(ISODateTime, 6, 2)); d := SysUtils.StrToInt(Copy(ISODateTime, 9, 2)); h := SysUtils.StrToInt(Copy(ISODateTime, 12, 2)); n := SysUtils.StrToInt(Copy(ISODateTime, 15, 2)); s := SysUtils.StrToInt(Copy(ISODateTime, 18, 2)); z := StrToIntDef(Copy(ISODateTime, 21, 3), 0); // Optional Result := EncodeDate(y, m, d) + EncodeTime(h, n, s, z); end; and also "What does the following Delphi function do?" function FileSizeToHumanReadableString(_FileSize: Int64): string; begin if _FileSize > 5 * OneExbiByte then Result := Format(_('%.2f EiB'), [_FileSize / OneExbiByte]) else if _FileSize > 5 * OnePebiByte then Result := Format(_('%.2f PiB'), [_FileSize / OnePebiByte]) else if _FileSize > 5 * OneTebiByte then Result := Format(_('%.2f TiB'), [_FileSize / OneTebiByte]) else if _FileSize > 5 * OneGibiByte then Result := Format(_('%.2f GiB'), [_FileSize / OneGibiByte]) else if _FileSize > 5 * OneMebiByte then Result := Format(_('%.2f MiB'), [_FileSize / OneMebiByte]) else if _FileSize > 5 * OneKibiByte then Result := Format(_('%.2f KiB'), [_FileSize / OneKibiByte]) else Result := Format(_('%d Bytes'), [_FileSize]); end; The answers will surprise you. And these were the shocking answers. The answers were actually quite interesting. Edited January 29, 2023 by dummzeuch 3 2 Share this post Link to post
Anders Melander 1783 Posted January 29, 2023 3 hours ago, dummzeuch said: The answers were actually quite interesting. How so? Share this post Link to post
Dave Nottage 557 Posted January 29, 2023 1 hour ago, Anders Melander said: How so? Check the links in his post Share this post Link to post
Anders Melander 1783 Posted January 29, 2023 (edited) 37 minutes ago, Dave Nottage said: Check the links in his post I think you're assuming that I find the answers interesting, which I do not. I'm asking why he thinks they're "quite interesting". From a socio-psychological viewpoint, I think people's view of ChatGPT is "quite interesting". Beyond that, from what I've seen so far, the only practical use for ChatGPT is to waste everybody's time. YMMV Edited January 29, 2023 by Anders Melander 3 Share this post Link to post
Dave Nottage 557 Posted January 29, 2023 4 minutes ago, Anders Melander said: I think you're assuming that I find the answers interesting, which I do not. I never assumed anything like that. 4 minutes ago, Anders Melander said: I'm asking why he thinks they're "quite interesting". What is missing from his post that raises that question? Share this post Link to post
Anders Melander 1783 Posted January 29, 2023 3 minutes ago, Dave Nottage said: What is missing from his post that raises that question? Um... An explanation of why it's interesting for example. As far as I can tell it performed just as one could expect. Is that interesting? Share this post Link to post
dummzeuch 1505 Posted January 29, 2023 (edited) 36 minutes ago, Anders Melander said: Um... An explanation of why it's interesting for example. As far as I can tell it performed just as one could expect. Is that interesting? I didn't expect it to perform that well, in particular the descriptions it gave for what those functions do. I found that interesting. These were simple tests where I knew the correct answers. It might be helpful in cases where I don't know the answers. Our possibly not. The code I'm usually dealing with is much more complex than a simple function. But you never know. Regardless of whether it will ever be helpful, I had some fun. Edited January 29, 2023 by dummzeuch Share this post Link to post
Anders Melander 1783 Posted January 29, 2023 1 hour ago, dummzeuch said: I had some fun. Sure; It's a nice party trick. But it gets old. 1 hour ago, dummzeuch said: These were simple tests where I knew the correct answers. Exactly. Most of the examples I have seen so far of ChatGPT magically writing code usually involves the operator coaching it through iterations of incorrect answers toward the known correct answer. ChatGPT's linguistic abilities are very impressive. The rest, not so much. Share this post Link to post
dummzeuch 1505 Posted January 30, 2023 7 hours ago, Anders Melander said: Most of the examples I have seen so far of ChatGPT magically writing code usually involves the operator coaching it through iterations of incorrect answers toward the known correct answer. I wasn't aware that I did that. Did I? Share this post Link to post
Fr0sT.Brutal 900 Posted January 30, 2023 (edited) Hmm, probably finding bugs in code would be very useful task for this tool. Another boring task that I think of is generating test cases for unit tests - could someone check this? Edited January 30, 2023 by Fr0sT.Brutal Share this post Link to post
Lars Fosdal 1792 Posted January 30, 2023 Having an AI that can point out bugs or suggest improvements in MY code, is far more interesting than having purely AI generated code, IMO. On the other hand, I use the ISO8601 methods in System.DateUtils 😛 Share this post Link to post
Rollo62 536 Posted January 30, 2023 (edited) This is the modern way of pair-programming, where also the human pair-partner can say something complete stupid from time to time. I see not much difference, only that ChatGPT has a lot more knowledge than a junior-pair-partner might have. Yaaaaa, its ONLY a text-processor ( byte by byte ) ... who cares ? Edited January 30, 2023 by Rollo62 Share this post Link to post
dummzeuch 1505 Posted January 30, 2023 2 hours ago, Lars Fosdal said: Having an AI that can point out bugs or suggest improvements in MY code, is far more interesting than having purely AI generated code, IMO. On the other hand, I use the ISO8601 methods in System.DateUtils 😛 You could aks ChagGPT to look for bugs in these. 😉 Share this post Link to post
haentschman 92 Posted January 30, 2023 (edited) ...here we are now! Not personal ...for the current and the next generation. Edited January 30, 2023 by haentschman 1 Share this post Link to post
Rollo62 536 Posted January 30, 2023 7 minutes ago, haentschman said: I think Albert was slightly wrong ( only in that case ... and with his cosmological constant ). We have already a world full of idiots, but unfortunately the technology has not yet surpassed our human interactions yet, to help us out of desaster. Maybe that is the whole problem 2 Share this post Link to post
baka0815 12 Posted January 31, 2023 Regarding IsoStringToDateTime the optimization/checks that ChatGPT introduced are not sufficient: if (d < 1) or (d > DaysInAMonth(y, m)) then raise EConvertError.Create('Invalid day of the month: ' + IntToStr(d)); if (m < 1) or (m > 12) then raise EConvertError.Create('Invalid month of the year: ' + IntToStr(m)); This checks the day using the month (m) which could have an invalid value (the check for valid months comes later). So it didn't take the ordering for the checks into account. 2 Share this post Link to post
Brandon Staggs 278 Posted January 31, 2023 On 1/29/2023 at 3:39 PM, dummzeuch said: But you never know. That's the problem. And ChaptGPT doesn't know what it does not know, which makes it even worse. ChatGPT is very confident in its answers even when it is egregiously wrong. But even worse is when it is confidently wrong in a subtle way. It's fun, perhaps interesting, but not useful. We already have college students surprised when they turn in work written by ChatGPT and get failing grades. These students (and people like them) are what scare me. They trust ChatGPT when they should not. 5 Share this post Link to post
Fr0sT.Brutal 900 Posted February 1, 2023 https://markwschaefer.medium.com/20-entertaining-uses-of-chatgpt-you-never-knew-were-possible-3bc2644d4507 Some more applications https://marketplace.visualstudio.com/items?itemName=DanielSanMedium.dscodegpt&ssr=false VSCode extension that uses Subj to generate comments or query code snippets 2 Share this post Link to post
Rollo62 536 Posted February 1, 2023 I can add recipe inventor for coctails, there were already many out there ... please have a try Share this post Link to post
baka0815 12 Posted February 1, 2023 (edited) The most important part is, that ChatGPT was trained with data from the past. There is no continuous aggregation of knowledge or something. So all answers, how accurate or fascinating they may be, are based on "old" data. Edited February 1, 2023 by baka0815 1 Share this post Link to post
Attila Kovacs 629 Posted February 1, 2023 11 minutes ago, baka0815 said: So all answers, how accurate or fascinating they may be, are based on "old" data. I'm not sure how would it affect the "write a poem in norwegian" command Share this post Link to post
baka0815 12 Posted February 1, 2023 It probably wouldn't affect a command like that (much), but we're talking about programming here. And there are new design patterns, language features and so on. A command like "write a poem in current teens language" might not work. Share this post Link to post
Rollo62 536 Posted February 1, 2023 30 minutes ago, baka0815 said: The most important part is, that ChatGPT was trained with data from the past. Sure: Everything was better in the past 3 Share this post Link to post
Kryvich 165 Posted February 1, 2023 It `s Magic. Before our eyes, large artificial neural networks are becoming more and more intelligent. 1 Share this post Link to post
Sherlock 663 Posted February 1, 2023 1 hour ago, Attila Kovacs said: I'm not sure how would it affect the "write a poem in norwegian" command It would probably use "old norse". 1 Share this post Link to post