this post was submitted on 17 May 2025
29 points (93.9% liked)
Rust
6940 readers
33 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
TL;DR - I didn't read the whole thing, but I couldn't help but ask about the elephant in the room: Lua (or another fast scripting language).
Here's the workflow:
You get most of the benefits of Rust, hot reloading, etc, precisely what OP was asking for. You can even use Lua code to break the rules in Rust.
Yes please!
Yeah, that always struck me as stupid.
As long as it's not allowed for "production" builds, I don't see an issue. Why not just have a compiler flag or something that turns it on or off? Then you can be ergonomic in development and principled in production.
The note about WebAssembly is odd, it's just slapping a fresh coat of paint over the same abstraction. If you're communicating with part of your app in WA, congrats, you have a crappier version of the same thing. WA is cool and can be part of the solution, but let's not clutch our pearls here.
Isn't that what lifetimes are? You're proving to the compiler that this can be a value type given it's known lifetime. If you don't know how long something will live, it has to go on the heap or you can have memory safety issues.
I agree and disagree here. On one hand, I do a lot of web dev, so async is really nice in keeping things fast. On the other hand, mixing the two sucks.
Here's my wishlist:
Yeah, the borrow checker is a bit too strict IMO. Ideally, the borrow checker would only trigger on things that could be run in parallel, such as with threads or async.
That said, I haven't had many issues, but I also don't make games. Generally speaking, copying is fine, which lets you have one place for doing modifications if you can send modifications to some kind of store.
All that being said, I feel like the real problem here is that OP wants one tool to solve the complete problem. They brush off WebAssembly for some reason. They don't consider writing a portion in a scripting language. They don't consider a microservice architecture, where parts can be hot swapped. Etc.
Rust is great at things it's great at, so use it for those. Build a system that has stable parts in Rust and unstable parts in something easier to iterate on.
I didn't read the whole thing, bit I got pretty far. Maybe I'll finish later, idk.
Lua has a really good C api. Not sure if there's anything for rust.
mlua looks nice. It also does async for coroutines, which is really nice.