Hacker News new | ask | show | jobs
by rep_movsd 1124 days ago
I asked ChatGPT about a very subtle python bug - it had to do with how python default params are actually mutable and will retain their mutated values across invocations.

I'd forgotten about this weirdness, but ChatGPT explained it.

I also managed to get ChatGPT to write two pieces of fairly complex C++ boilerplate - one was a std:vector that used mmap() and mremap() to grow linearly rather than by a fixed factor (also avoiding memory copy on resize)

Then I made it write a vector whose iterator was an integer index rather than a pointer.

I made it write all the unit tests and benchmarks for these and it did everything correctly except not knowing that munmap() needs the size parameter rounded to the nearest page.

Obviously I hardly managed to get everything correct on a single prompt. It took an iterative conversation and successive refinement