THIS is how it's done. This is a masterclass in how to effectively use LLMs for such things. Providing proper context (Goldilocks -- not too much, not too little), asking targeted questions, and then continuing with intelligent dialogue with the LLM.
I've had several similar examples where LLMs have significantly augmented my workflow, but none so clean and encapsulated (and beautifully explained) as this example.
Thank you, Salvatore!
Interesting, but note that the first bug pointed out by Claude is probably a false positive.
In the original version of the code, if a link is removed and it is the last link, then the condition `remove_idx == worst_idx` must be true, which leads to falling back to the most general update function, which handles the case of an empty list correctly.
(Of course, the suggested fix doesn't hurt, and people may disagree about which version of the code is clearer.)
To paraphrase Rowling, LLMs are rather cleverer than most software, and so their mistakes tend to be correspondingly cleverer. The trick is to ensure that their mistakes don't become correspondingly huger.
Very exciting to see this. I was already excited when antirez said he was going to record these.
I found that Claude has really studied the Redis code base which has one of the highest comment to code ratios I have ever seen outside of a literate program.
IMO, there aren't enough videos of watching people work, esp in programming. I learn something every single time I peer over someones shoulder and watch them code.
% tokei .
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
C 141 153737 104162 33735 15840
C Header 78 15349 10367 3737 1245
CMake 3 171 125 22 24
JSON 400 24216 24213 0 3
Makefile 2 714 517 80 117
Markdown 2 274 0 237 37
Module-Definition 1 11171 9086 0 2085
Shell 1 16 15 1 0
===============================================================================
Total 628 205648 148485 37812 19351
===============================================================================