logoalt Hacker News

cornholioyesterday at 8:35 PM4 repliesview on HN

> Rust is perfect for writing all of code using LLM. It's strict type system makes is less likely to make very dumb mistakes that other languages might allow.

I question this. Yes, strong enforcement of invariants at compile time helps the LLM generate functional code since it gets rapid feedback and retraces as opposed to generating buggy code that fails at runtime in edge cases.

On the other hand, Rust is a complex language prone to refactoring avalanches, where a small change in a component forces refactoring distant code. If the initial architecture is bad or lacking, growing the code base incrementally as LLMs typically do will tend towards spaghettification. So I fear a program that compiles and even runs ok, but no longer human readable or maintainable.


Replies

theptipyesterday at 9:32 PM

> Rust is a complex language prone to refactoring avalanches

This may be so, but LLMs are great at slogging through such tedious repercussions.

I would say if the language prevents sloppy intermediate states, that actually makes it more amenable to AI; if you just half-ass a refactor into a conceptually inconsistent state, it’s possible for bad tests to fail to catch it in Python, say. But if many such incomplete states are just forbidden, then the compiler errors provide a clean objective function that the LLM can keep iterating on.

show 1 reply
carllercheyesterday at 8:46 PM

> On the other hand, Rust is a complex language prone to refactoring avalanches, where a small change in a component forces refactoring distant code.

Are you saying this out of personal experience or just hypothesizing? I am working on a large, complex rust project with Claude Code and do not experience this at all.

show 3 replies
staticassertionyesterday at 8:41 PM

It's very easy to just instruct the LLM to build using isolated crates, to maintain boundaries, focus on "ports and adapters", etc, and not run into this - in my experience.

I haven't had any issues with this getting out of hand on >10KLOC vibed rust codebases.

show 2 replies
mohamedkoubaayesterday at 8:53 PM

[flagged]