March 19, 2023
ChatGPT did a first pass on translating the code. (This was good enough that I only needed a few minutes of cleanup.) Then it wrote the initial README, the test files, and the
tsconfig.js files. (Ditto.)
I didn’t time the amount of work this took, but I would estimate ChatGPT saved me 80% of the effort, and 90% of the drudgery. Most of the remaining work was adding some material to the README, and adding a feature that I had omitted from the Python version that I gave to ChatGPT. (I decided to port this feature without ChatGPT, at least in part because I wanted a change of pace to coding from prompt whispering.)
The responses shown were the first responses. Nothing was cherry-picked.
[Here, I posted this version of the code.]
- “Note that I made a few changes” is ChatGPT, not me.
import … from "typed-python"is non-idiomatic (and probably doesn’t work). Also,
@dataclassis both unnecessary and invalid. I edited these out by hand. An alternative would have been to refine the prompt, or include a follow-up directive. This was only partly an exploration of ChatGPT, though, and I was eager to get back to coding.
Note that ChatGPT is generating these from the source code. It only has access to the function names and implementations. I didn’t enter the Python README or test cases, and these didn’t exist on the web until a few days before this chat.
Generating a README
ChatGPT generated this from the source. It also had access to the test cases that it previously generated, and which it therefore could have used as a form of loud thinking.
Generating Configuration Files
Here’s an area that can take a while, if I’m new to a framework or language, or have been away from it for a while.
When I return to a programming language or framework after a break, these are some questions I get hung up on. (It’s an internal form of bikeshedding.) Asking ChatGPT can a sophisticated form of talking to the rubber duck, only about more than just debugging.