back to using Rust again after 1.5y, and having a really really great time using it with Claude Code.
personally beats Bun for scripting too? Notes on why:
- context: my main task rn is to write various complex scripts which munge data from websites & GCS, usually writing them back to GCS
- at reasonably large scale: I’m def trying to parallelize & unbottleneck a lot
- I used Python & Bun each for a bit, but maybe prefer Rust?
- There’s a reasonable amount of vibe coding. I know the precise steps quite well but I’m often asking it to eg: list X kind of file from GCS, parallelize Y, fetch Z in ways Claude is good at.
- typing is so much better!
- makes me reflect on the fact that actually most type systems are expressive enough that it doesnt matter.
- the real important factor is level of typing in the ecosystem, esp for small projects where you interface w many libraries.
- ie: Python typing is bad because many many libraries lack it. Even with TS, major libraries will sometimes still typealias any
- errors being passed as optionals is really nice. Again in TS, you could do this via effect TS, but your upstream libs won’t really?
- you’re also likely writing out of distribution TS which models are likely worse at
- way fewer logic errors in general! Cargo check is good because typing is more prevalent.
- I totally forgot about this, but it often feels like the Rust libraries are just better?
- the default ish CLI arg parsing library feels so much more pleasant than argparse or commander. It’s very typey
- for example, frequent operation is, I’m downloading 1k files. Do this in parallel w 50 at a time.
- Claude writing a Bun script will always do the stupid thing of slicing into batches of 50, and sequentially promise.alling each batch. This is much slower, because you’re seldom actually at 50. Particularly extremely bad if some tasks can take >10x avg time
- the right approach is to remind Claude to use something like p-limit. It sometimes still gets syntax wrong?
- otoh: in rust it just does the reasonable thing 100% of the time because a semaphore is a common primitive
- in general, it feels there’s almost this inductive bias causing models to write better Rust than they do TS?
- the default Rust way to do things is more likely the right way than a hacky way.
- the model basically ~never coerces types or does weird typing stuff
- the default first library for something is on average really good
wow writing rust is so joyful