Post

I've been in the deep end on the Radiance AST -> IR lowering pass, but I'm starting to see the light of day. I did things a bit differently this time in terms of code production, and I'm not sure it was worth it: I had Claude generate this compiler pass from scratch, which resulted in...

... a 6000 LOC Radiance module which I've been reviewing and simplifying for the last two weeks. The code it generated is mostly correct and well tested, but I've been able to reduce it to 4300 LOC while keeping functionality intact and simplifying things that could be simplified. It's been...

0 reposts0 likes

... an interesting exercise. Could I have written this myself in less time? Maybe, I'm not sure. The biggest issue with getting Claude to write code like this is that it doesn't *think*. For instance, it's happy to work within the given constraints without asking "why do these constraints exist?" --

Sometimes, adding 10 lines of code in another module (something it wasn't instructed to do) would allow for removing 50 lines in the module it was working on. It's not clear whether this is solvable via prompting due to unknown unknowns at the time of prompting.

Another issue is that it seems to forget code it's written, so it doesn't diligently factor out similar behavior the way a human would. You would think that it's good at noticing patterns in the code, but it isn't, even when specifically prompted to review its code and simplify it...

I've done multiple passes (and even with Gemini 3), essentially asking it to find patterns and factor them out, or maximize code re-use, and yet through manual review have noticed dozens of obvious simplification opportunities it did not point out to me. This is quite unfortunate.

Thanks for sharing! What’s your takeaway? If you were to approach a similar task in the future, would you simply start and do it by hand, or would you again get Claude to throw a block of marble at you that kind of resembles what you’re aiming for and then refine and chip away at it?

The problem is identifying how Claude will perform early enough in the process, and that's hard, even with experience using LLMs. I think in the future I will limit this kind of workflow to maximum 2K LOC, anything over that should be written by hand or broken up in pieces somehow.

And "by hand" doesn't mean typing every character manually, but using Claude in a piecemeal fashion, ie. telling it specifically what functions to write, vs. telling it what the end state should be.