Ask HN: What makes a programming language great for code generation?

3 keithasaurus 3 5/22/2025, 4:54:13 PM
At the moment, it seems programming language popularity might be the best indicator of whether an LLM will be proficient at generating working code (e.g. Python, JavaScript, Java, C). However, it seems plausible to me that languages which require the least amount of extra reasoning (and/or tokens?) could allow LLMs to produce working code more often. For instance, I would imagine immutability to be easier for an LLM to "reason" about than local mutability. The same could be said for strict formatting, explicit types, concise syntax, etc. By that reasoning I might expect functional languages to be particularly good targets.

Is there any evidence supporting these ideas? Should there be (or are there already) languages developed with LLMs in mind? Will we see developers pushed more toward languages that LLMs are more proficient at?

Comments (3)

muzani · 46m ago
Quoting Paul Graham,

John McPhee wrote that Bill Bradley's success as a basketball player was due partly to his extraordinary peripheral vision. "Perfect" eyesight means about 47 degrees of vertical peripheral vision. Bill Bradley had 70; he could see the basket when he was looking at the floor. Maybe great hackers have some similar inborn ability. (I cheat by using a very dense language, which shrinks the court.)

https://paulgraham.com/gh.html

It's doubly so with LLMs. You don't need as much clean code. Larger files. Make it easier to structure files for LLMs to navigate. Linting and tests that tells AI when it's making mistakes. AI doesn't always run the code, but something like Dart with hot reload, gives it much faster feedback.

lendacerda · 9h ago
Yes you need good amounts of data for the LLM to learn the language. But after some point, the easyness of the language is more important. Python and Javascript (or TS) are kings

Ideally, you dont wanna LLM to reason. You yourself should understand the problem and the better solution for it, and then the AI just executes on it

Bostonian · 10h ago
I think you want a language where code that compiles is more likely to be correct code. Code that does not compile is only an annoyance, since it can't make its way into production.