Hacker News new | ask | show | jobs
by guessmyname 16 days ago
Pi is good in concept, but why couldn’t they choose a compiled language instead of TypeScript?
9 comments

I imagine because they want to support plugins, and plugins in compiled language are a lot less natural than plugins in languages like TypeScript or Python.
well neovim does that beautifully
since pi is built to modify itself, isn't it better to use a language like typescript where LLMs have a LOT of training data?

a harness doesn't do any computations by itself so what benefit is using a compiled language?

i find LLMs generally play better with compiled languages actually, they do great with rust. you can think of it almost as analogous to a harness.
The more structure the better. Provides strong guardrails.

I’ve had great experience with Elixir and the new compiler combined with Ash.

They play better with statically typed languages, not compiled ones in particular. Rust's typing is stricter than Typescript though so that probably helps.
For TUIs, Rust/Go vs Typescript doesn't really makes a huge performance difference and you lose the 50x bigger community advantage of Typescript.
It makes a huge memory difference.
Not really because you're not building a database or GUI app where using native elements & data structures help a lot with memory pressure.

TUI renderer is the one using the memory heavily so your terminal takes the heavy lifing. If you're managing the buffers and out-of-screen context good enough, Typescript can be pretty efficient.

I love opencode but it chews through memory on my 64gb MacBook Pro. Can’t have too many long running sessions because the memory use just slowly creeps up.

It’s not about the terminal at all which as you noted accounts for minimal isage. It’s all the internal chat and history and everything else the agent tracks - all of which are smallish (and largish) strings allocated on the heap.

I don’t have the same issues with rust based tuis.

What's the rust based tui that has same capability as opencode?
not 100% feature compatible but close enough in terms of capabilities that I use: codex, and grok build.
I would imagine the extension system they built would be much more difficult to manage. They could have opted for Lua, though, I suppose.
I agree, but there are a lot of great reasons for TypeScript:

It's hot reloadable, so any modifications an agents makes can be surfaced in the active session.

Nearly everything is already written in TS which makes integrating Pi into other software, or other software into Pi much easier.

Sorry for self-insert, but that's exactly what I thought and I built https://github.com/gi-dellav/zerostack, so you are right I'd say
Does it matter to you as a user, other than the Nodejs/npm requirement?
Why does it matter? Agent harnesses aren't doing anything that would make a compiled language more suitable than a scripting language.
Opencode is written in Go.
It is written in Typescript.

https://github.com/anomalyco/opencode

There is an archived Opencode project written in Go but I don't think it is affiliated.

https://github.com/opencode-ai/opencode

This is a pretty good summary of what happened:

https://news.ycombinator.com/item?id=44483251