Hacker News new | ask | show | jobs
by echelon 19 days ago
> Languages with a single way to do things benefit the most: Rust

I posit that Rust is the optimal language to emit from LLMs unless you have to target web, a specific platform, or a legacy project:

- The required error handling for Option<T>, Result<T,E>, and required destructuring of sum types naturally reduces errors by an order of magnitude

- If it compiles, chances are higher the code is correct. Especially if you're using strong typing.

- The training data for Rust is likely of a higher quality than, say, Javascript

- The resulting code is fast and portable

- You get really nice threading and async, and you don't have to think about the silly "color problem" because the LLM handles it for you.

- Using an LLM takes away any trouble you'd have with the borrow checker or refactoring, or otherwise working in a slightly more difficult language.

- Applications are single binary executables.

Since LLMs let you generate and manipulate Rust code as fast as you would Python, why not just emit Rust instead? It's the least brittle language, and it's incredibly performant.

3 comments

It's displayed in my practice that LLMs master Rust even as weaker models like deepseek.
Even for the web, Rust is a great language out of LLMs. It was quite surprising given the early performance of Python that Rust does so well. It really speaks to the high dimensional generality of transformer translation models.
>I posit that Rust is the optimal language to emit from LLMs unless you have to target web, a specific platform, or a legacy project:

What would you suggest is optimal for targeting web?

LLMs seem to have an easy time with Elixir and Phoenix in my testing.