Live data from Hacker News

What's the best programming language for coding agents?

danluu.com

171–180 of 201 posts

Re: What's the best programming language for coding agents?

#171
IMO, rust.

Not because it is concise but because you won't need to spend tokens debugging segfaults and a whole spectrum of bugs that the compiler catches. LLMs usually write tests in the same source files so most features are implemented and working in one shot.

Re: What's the best programming language for coding agents?

#172
I few months ago I tried to make a project using Fennel (a lisp flavor of lua). I always wanted to use lisp, and hey, since it was the OG AI language I though why not.

Claude could work on it okay apparently but some local llm's struggled with it and got stuck in reasoning loops trying to close the parenthesis.

Re: What's the best programming language for coding agents?

#173

Is there a relationship between how good a programming language is for coding agents and how popular it is among humans? If so, wouldn't Python be the best language for agents, since it's is the most popular (and hence has the most context available for models)?

As much as I love Python, JavaScript (including TypeScript) is probably more popular.

I was going off this for popularity: https://stackoverflow.blog/2023/01/26/comparing-tag-trends-w...

Re: What's the best programming language for coding agents?

#175
post #60

Ive been amazed at how well LLMs are at writing Gleam[1] and Lustre[2]. Compared to a mainstream language, there is basically zero gleam code in the training data. I have no evidence to back this up, but I suspect that languages that are good for humans[3] will be good for LLMs. Compiled, strongly typed, statically typed, immutable, pure functions, pattern matched, memory safe, etc. [1] https://gleam.run [2] https://…

I’ve been developing a language for a few years, and even with incomplete semantics and a simple one page example LLMs don’t have much trouble writing it. I think the language/syntax has an impact, but the tooling around it will be most important for LLMs, in the same way it is for humans.

I'd agree. I've spent the last month running an experiment, having an LLM being up a self-hosted compiler. It has no problem writing complex code in a never before seen language with severe constraints[immutable, no naked recursion, recursion schemes].

The biggest challenges are maintaining non-functional requirements, specifically CPU and memory effenciency.

Re: What's the best programming language for coding agents?

#176

Ive been amazed at how well LLMs are at writing Gleam[1] and Lustre[2]. Compared to a mainstream language, there is basically zero gleam code in the training data. I have no evidence to back this up, but I suspect that languages that are good for humans[3] will be good for LLMs. Compiled, strongly typed, statically typed, immutable, pure functions, pattern matched, memory safe, etc. [1] https://gleam.run [2] https://…

I think that just shows LLMs are great at almost any language. As the post says, it can get very poor, as with J and Factor, but anything remotely easy to read for humans seems to be perfectly fine for LLMs. I can say I am still to try a language they struggle with myself. Tried Dart, Groovy, Common Lisp, Elisp… and more. It is an expert in all of them and I can’t really tell they advantage one over another. Our mixed Kotlin Java huge code base is a walk in the park for Opus5 and Fable5.

Re: What's the best programming language for coding agents?

#177
post #47

Ive been amazed at how well LLMs are at writing Gleam[1] and Lustre[2]. Compared to a mainstream language, there is basically zero gleam code in the training data. I have no evidence to back this up, but I suspect that languages that are good for humans[3] will be good for LLMs. Compiled, strongly typed, statically typed, immutable, pure functions, pattern matched, memory safe, etc. [1] https://gleam.run [2] https://…

That's not a take I was expecting to find here. I've found most LLMs absolutely dreadful when it comes to Gleam, to the point that I most often disable even inline autocomplete when working in Gleam codebases. Too often I find them getting pulled into larger ruts in the training data and trying to insert language features that don't exist (ifs, loops, and syntactic constructs) from more popular languages like TypeScr…

You’re talking about autocomplete! That’s always a poor model doing it because it has to be fast enough. I never use that anymore in any language, it’s only occasionally helpful. I suspect everyone is talking about agent harnesses here , not autocomplete. With a harness, the agent not only can be more powerful (and slow) it can go into “thinking” mode and once it comes back with some code , it’s almost always quite good. I think this is true in Gleam and in many other languages, no matter how minor, as long as it has good docs and good error messages so the AI will fix dumb mistakes before you get to see it.

Re: What's the best programming language for coding agents?

#178
This analysis might benefit from a multivariate regression. You mention a few different explanations for why performance differs and if you could get solid numbers for those you could try teasing that apart.

Also a small note: the axis on one of your plots alternates between 4% and 5% increments whilst holding the ticks constant. Maybe because of rounding?

Re: What's the best programming language for coding agents?

#179
post #121

Contrary to what most comments seem to indicate, my takeaway from this is that it doesn't really matter all that much for the agents what language you pick. If humans are still to be involved in the process at some point, then its imperative that the language can be read by them, so the preference or skills of the developer(s) are of primary concern, not the agent.

Similarly contrary: I don't know why people aren't talking more about Python. Am I interpretting the final vs. graph incorrectly? I've got some education in materials engineering; it'd be trivial to drop a curve (line) for optimizing the language selection, and Python obviously comes out on top. The author doesn't even mention it. That discredits the whole article as far as I'm concerned.

You are the one cherry picking perhaps the first two charts. Look at the various metrics at the end in the Zstd vs Pandoc charts. There is just no clear advantage for Python across those metrics which are the one you really want to know about! If anything F# seems like a better top of the line language?!

Re: What's the best programming language for coding agents?

#180

We studied this question pretty systematically in the MirrorCode paper [1], comparing Python, C, Rust, Go, OCaml, and Ada across 19 very long-horizon tasks, for Claude Opus 4.7 and GPT-5.5. > In our results, there was little sign of inter-language differences in solve rates, for any model (Figure 5b). This suggests that AI models have learned generalized programming skills, rather than pattern-matching syntax. This d…

I think the main advantage of Static-compiled-strongly-typed languages will be that it will allow the [automated] generation of comprehensive static analysis test suites to provide specific and explicit assurances about the code.

That is, for larger, more complicated software. There could be a set of static analysis tools that guarantee the correctness of the code. This would be very cheap to run and maintain.

Post reply on HN