Live data from Hacker News

A case for Go as the best language for AI agents

getbruin.com

41–50 of 310 posts

Re: A case for Go as the best language for AI agents

#41

I happen to just stumble across this article https://felixbarbalet.com/simple-made-inevitable-the-economi... extolling the virtues of Clojure. It specifically calls out Go for not being simple in the ways that matter for LLMs. I've no idea myself, I just thought it was interesting for comparison.

I was prototyping to this end the other day - what would it be like for a coding agent to have access to a language that can be:

- structurally edited, ensuring syntactic validity at all times

- annotated with metadata, so that agents can annotate the code as they go and refer back to accreted knoweledge (something Clojure can do structurally using nodepaths or annotations directly in code)

- put into any environment you might like, e.g. using ClojureScript

I haven't proven to myself this is more useful/results in better code than just writing code "the normal way" with an agent, but it sure seems interesting.

Re: A case for Go as the best language for AI agents

#42
For the go vs rust points in the article:

- I agree that go's syntax and concepts are simpler (esp when you write libraries, some rust code can get gnarly and take a lot of brain cycles to parse everything)

- > idiomatic way of writing code and simpler to understand for humans - eh, to some extent. I personally hate go's boilerplate of "if err != nil" but that's mainly my problem.

- compiles faster, no question about it

- more go code out there allowing models to generate better code in Go than Rust - eh, here I somewhat disagree. The quality of the code matters as well. That's why a lot of early python code was so bad. There just is so much bad python out there. I would say that code quality and correctness matters as well, and I'd bet there's more "production ready" (heh) rust code out there than go code.

- (go) it is an opinionated language - so is rust, in a lot of ways. There are a lot of things that make writing really bad rust code pretty hard. And you get lots of protections for foot meets gun type of situations. AFAIK in go you can still write locking code using channels. I don't think you can do that in rust.

- something I didn't see mentioned is error messages. I think rust errors are some of the best in the industry, and they are sooo useful to LLMs (I've noticed this ever since coding with gpt4 era models!)

I guess we'll have to wait and see. There will be a lot of code written by agents going forward, we'll be spoiled for choice.

Re: A case for Go as the best language for AI agents

#43
Have yet to find a better choice than OCaml:

- Strongly typed, including GADTs and various flavors of polymorphism, but not as inscrutable as Haskell

- (Mostly) pure functions, but multiple imperative/OO escape hatches

- The base language is surprisingly simple

- Very fast to build/test (the bytecode target, at least)

- Can target WASM/JS

- All code in a file is always evaluated in order, which means it has to be defined in order. Circular dependencies between functions or types have to be explicitly called out, or build fails.

I should add, it's also very fun to work with as a human! Finding refactors with pure code that's this readable is a real joy.

Re: A case for Go as the best language for AI agents

#44
Strange article. Why is Go the best language for agents instead of, say, Python? Here are the points the author seems to make:

---

# Author likes go

Ok, cool story bro...

# Go is compiled

Nice, but Python also has syntax and type checking -- I don't typically have any more luck generating more strictly typed code with agents.

# Go is simple

Sure. Python for a long time had a reputation as "pseudocode that runs", so the arguments about go being easy to read might be bias on the part of the author (see point 1).

# Go is opinionated

Sure. Python also has standards for formatting code, running tests (https://docs.python.org/3/library/unittest.html), and has no need for building binaries.

# Building cross-platform Go binaries is trivial

Is that a big deal if you don't need to build binaries at all?

# Agents know Go

Agents seem to know python as well...

---

Author seems to fall short of supporting the claim that Go is better than any other language by any margin, mostly relying on the biases they have that Go is a superior language in general than, say, Python. There are arguments to be made about compiled versus interpreted, for example, but if you don't accept that Go is the best language of them all for every purpose, the argument falls flat.

Re: A case for Go as the best language for AI agents

#46
post #5

I think the more you can shift to compile time the better when it comes to agents. Go is therefore 'ok', but the type system isn't as useful as other options. I would say Rust is quite good for just letting something churn through compiler errors until it works, and then you're unlikely to get runtime errors. I haven't tried Haskell, but I assume that's even better.

Haskell is great, for what it's worth, but as with any language you have to reign in the AI's use of excessive verbosity. It will stack abstractions to the moon even for simple projects, and haskell's strengths for humans in this regard are weaknesses for AI - different weaknesses than other languages, but still, TANSTAAFL I am trying out building a toy language hosted on Haskell and it's been a nice combo - the toy…

> Haskell is great, for what it's worth, but as with any language you have to reign in the AI's use of excessive verbosity. It will stack abstractions to the moon even for simple projects, and haskell's strengths for humans in this regard are weaknesses for AI - different weaknesses than other languages, but still, TANSTAAFL

I haven't had this problem with Opus 4.5+ and Haskell. In fact, I get the opposite problem and often wish it was more capable of using abstractions.

Re: A case for Go as the best language for AI agents

#48
post #5

I think the more you can shift to compile time the better when it comes to agents. Go is therefore 'ok', but the type system isn't as useful as other options. I would say Rust is quite good for just letting something churn through compiler errors until it works, and then you're unlikely to get runtime errors. I haven't tried Haskell, but I assume that's even better.

Of my friend group the two people I think of as standout in terms of getting useful velocity out of AI workflows in non-trivial domains (as opposed to SaaS plumbing or framework slop) primarily use Haskell with massive contexts and tight integration with the dev env to ground the model.

Re: A case for Go as the best language for AI agents

#49
post #5

I think the more you can shift to compile time the better when it comes to agents. Go is therefore 'ok', but the type system isn't as useful as other options. I would say Rust is quite good for just letting something churn through compiler errors until it works, and then you're unlikely to get runtime errors. I haven't tried Haskell, but I assume that's even better.

+1 to Rust - if we're offloading the coding to the clankers, might as well front-load more complexity cost to offload operational cost. Sure, it isn't a particularly ergonomic or simple language but we're not the ones who have to use it.

Re: A case for Go as the best language for AI agents

#50
post #22

Doesn't the high quantity of boilerplate pollute the context, thereby making agents less useful over time? i.e. go is not "token efficient"

Language models need redundancy (as informing structure). Not surprising, since they're trained on human language. It's hard to train a model on a language with a high entropy. I haven't tried it, but I think LLMs would perform quite badly on languages such as APL, where structure and meaning are closely intertwined.
Post reply on HN