Tokio is a runtime for writing reliable asynchronous applications with Rust. It provides async I/O, networking, scheduling, timers, and more.

113 points•sagacity•6 days ago•100 comments•

100 comments

muglug6 days ago
> Rust is the best general-purpose language for the new world of AI-driven development.

Funny, the Python guys say Python is the best general-purpose language for AI and the Go guys say Go is the best general-purpose language for AI etc etc

Tuna-Fish6 days ago
I've found that the guardrails of a strong, expressive type system are amazing for LLMs, especially if you don't use the top-of-the-line models but stick to the cheaper options. Agents need feedback to do their magic, and the type system is great for that.

But on the other hand, the compile time of Rust is really counterproductive. On large, established projects, most prompts I write now spend more time compiling on my machine than they spend outputting tokens. In a way this is great because the tokens are the expensive part, but it does mean that when faster LLMs will come, they will not meaningfully improve iteration speed for me.

I wonder how much of the compile time of Rust is inherent to the type system. There might be room for a language with slower runtime speed (GC?), but as good of a type system as Rust, so long as compile times are much faster. Switching languages has never been easier, anyone have any suggestions? IMO hard requirements are algebraic types and error handling based on them.

dabinat6 days ago
Compile times in Rust are partly the amount of analysis that occurs, partly that it uses LLVM which is optimized for creating fast code at runtime but not necessarily fast-compiling code, and partly the fact that the Rust compiler is inefficient and does the same work twice or recompiles things it doesn’t need to.

But you can speed things up a lot by organizing your project into separate crates (which are compiled in parallel) and tweaking compiler flags. I speed up a large project by 7x this way.

Also, if you’re using fat LTO in release builds, switch to thin. It’s almost as fast at runtime and much much faster to compile.

scns5 days ago
> There might be room for a language with slower runtime speed (GC?), but as good of a type system as Rust, so long as compile times are much faster.

There is OCaml which compiles very fast in debug mode.

stymaar5 days ago
> But on the other hand, the compile time of Rust is really counterproductive.

Since it's going to be mostly cargo check and incremental builds, I don't think it matters in practice.

pjmlp5 days ago
OCaml, Haskell, F#, Standard ML.

The big difference to Rust is the availability of interpreters, REPL, which can equally load compiled code, and full blown AOT for release builds.

Rust's problem isn't type system, rather lack of tools.

jaen5 days ago
Python has a strong, expressive static type system with a very fast type checker (Pyrefly).
binarin6 days ago
It's the Python guys whom I totally don't understand - it's all fun and dandy until you try to maintain and cleanup a legacy codebase of tens of millions lines of code in any dynamic language :)

With or without AI - doesn't matter. Only at that point you gain understanding of the limitations both of LLMs and of dynamic languages.

edit: Forgot about "Nightmare" difficulty - try enjoying dynamic languages and LLMs when your legacy codebase is earning tens of thousands $ per second.

infamia5 days ago
Unless you're doing something really dynamic, I don't really understand this position and would like to learn more. for most cases gradual typing is a great option that can be done incrementally in Python (two things even cheap agents are really good at).
orf5 days ago
> your legacy codebase is earning tens of thousands $ per second.

Your legacy codebase generates ~300 billion a year?

chaostheory6 days ago
There is some truth for all three.

1. Python has a lot of training data

2. Go runs with the philosophy of one same way to do stuff even further than Python. It’s also typed

3. Rust’s type system and strict compiler is what helps keep AI on guardrails

nobleach6 days ago
I have prompted a LOT of Go in the past few months. While LLMs do indeed know Go very well, the amount of over-abstraction I'm seeing is awful. It's not at all indicative of code that I'd write myself. The whole point of Go is to have a language that is immediately approachable by juniors. And I've tried to keep my code in that lane. The reason I won't prompt Rust at all, is that I know it'll output working code... that I likely will not understand. (that's not the LLM's fault)
lucideer6 days ago
I don't write Rust & have no horse in this race but my intuition on this is you have 3 scenarios:

1. Humans writing code: here the usability, readability, accessibility of the language matters - strictness can be a hurdle depending on how a language is designed, so ultimately it's a trade-off.

2. Humans reviewing AI-authored code: here the requirements of (1) still apply to the code reviewer

3. Autonomous agents writing code: above requirements no longer apply so having a strictly-defined language with tight guardrails is the primary consideration.

I think most people are operating workflows in category (2), but it seems uncontroversial to say Rust is more suited to category (3) than python or golang. Typescript, Haskell, Elm, Ocaml could be considerations but you'll find Rust hard to beat here. Certainly neither python nor golang are in the running at all.

jazzypants6 days ago
Some absolutely great work, but I don't know why you would come up with a new term for a server component (shard). Why not just use the obvious client/server annotations so you don't have to define a novel term for new users?
carllerche5 days ago
Just needed a different name for it. What should it have been called? `#[component]` is not reachable from the client. We went with `#[shard]` to make it clear that it is different (callable from the client).
lackoftactics6 days ago
I really like the direction Topcoat is going in as a Rails developer. Although it is just a bit itchy to my eyes, it is not acid-level, though.

The things that look great are LiveView and getting rid of boilerplate for client-side reactivity

excsn6 days ago
I used to write Leptos, but abandoned it. I hoped the experience would get better, it took a lot of memory just for the language server to validate especially. Web apps become too cumbersome to maintain in bigger distributed teams where we want fast feedback. I think writing web apps in straight rust will always be niche. There's not many frontend devs who write React or Vue who want to write straight Rust just because of safety or performance.

That's why I created SnapFire FSR (https://www.snapfirers.com), but many examples, to allow frontend devs to develop in their favorite framework (or mixture of). Write Tera templates, Web Components if you don't want to bring in frameworks like I tend to. Don't need to pay massive switching costs which, even with, AI not fun.

I found it much better to create and maintain web apps near the markup and language they originated from. You won't find me writing straight Rust for Web Apps unless I need to anymore.

I'm going to continue to work on this and switch all my leptos and svelte sites over.

sureglymop3 days ago
I hope I'm not discouraging you with what I'm writing. This looks to me like a cool project/idea. Unfortunately the landing page just immediately made me uninterested when I tried reading the text.

I think the reason for that is, the text to me feels immediately AI generated which evokes a feeling of "the human didn't care enough to do the easiest part, which is to describe their project themselves".

vmsp4 days ago
This is the kind of thing I would have found amazing a year ago — maybe even less — but now I can't help but wonder "What for?"

A coding agent already knows how to generate whatever it needs on the backend plus the client-side pieces. What's the point in having a Rust subset that compiles down to JS when I can just not have it and the result be the same?

I feel like the question these days is to figure out the right level of abstraction and Topcoat might be too much.

PS: This isn't a jab at the library or its authors. It's just me trying to figure out what still matters in the age of LLMs.

Read the full thread on Hacker News →

Related stories