4 ms·
Enthusiasm can be a problem. You don't really need Rust for server-side Web stuff. That's what Go was designed for. Go comes with well-exercised libraries for
by Animats 4y ago
Enthusiasm can be a problem.
You don't really need Rust for server-side Web stuff. That's what Go was designed for. Go comes with well-exercised libraries for most of the things people do web server side.
As I've mentioned before, I'm writing a metaverse client in Rust. Now that's something for which Rust is worth the trouble. You need concurrency. A lot of tightly interlocked concurrency. If you want a large high-detail virtual world, you need to keep a half dozen CPUs, a multi-threadable GPU, and the network all quite busy. There's a huge payoff in being able to do all that threading without spending time in a debugger. I've opened a debugger once in the last two years, and that was for a bug in someone else's "unsafe" code.
The price of using Rust is that you hit bleeding edge problems. I just finished writing a basic internationalization package to translate menu items and such. That should be unnecessary at this late date. But it turns out that the basic "internationalization" crate is fundamentally flawed, and even its creator now says so. The crate most commonly used, "fluent", is not suitable for use with the immediate-mode GUI used for games, "egui", because you need lookup memoization for strings retrieved on every frame. A lot of time is wasted on side issues like this.
Many widely used Rust crates are still at version 0.x.x, and not really stable yet. The language and core tools are pretty solid now, but the crates are all volunteer and not well-curated. The graphics systems I'm using, Rend3 and WGPU, are under heavy development, and not yet ready for prime time. I'm in regular contact with those dev groups.
There's not much off the shelf code for metaverses yet. Unity and Unreal Engine don't support metaverses yet, where the content comes from hundreds or thousands of people not working under common management. It's not like picking one of a dozen widely used payment rail systems. So you're going to have to do some serious development from a cold start. Rust is good for that.
For routine web development with short deadlines, Rust may be overkill or unsuitable.
- brundolf 4y agoSometimes I think about how many weeks I’ve wasted debugging my local python environment, managing venvs and various build/package management/testing tools, manually editing my shell’s rc file to approximate a sane dev flow, fixing broken dependencies, re-fixing them whenever I pull changes from one of a dozen repos, etc. I can’t help wonder if Rust would be a net productivity gain solely based on that stuff. And then, less dramatically but still significant, there’s the runtime errors and all the hand-written JSON (de-)serialization code. It adds up.
- Yoric 4y agoI'm writing web or web-adjacent code in Python, TypeScript and Rust. Recently, I ported one of my Python projects to Rust using PyO3 for exactly the reasons you mention. I haven't battle-tested this Rust code yet, so I can't tell you whether this was a good time investment. What I can tell you, though, is that it was much easier than I thought.
- pizza234 4y agoI've recently worked on rewriting small-but-not-trivial dynamically typed programs in Rust, and also work on tooling at my company (also written in a dynamically typed language); the sore points you've mentioned are very real and significant. However, the productivity gains mentioned are an effect of any statically typed language, not just of of Rust, and the problem is that Rust's cognitive overhead offsets them. I definitely would not bring Rust to the table at my company because of that; I've recently had an experience with an engineer who thought it was fun to use, but couldn't write anything with it; I'm sure that with a simpler language, they could have. I think there are new languages that are a valid middle ground (between Golang and Rust), although they don't have yet enough traction and/or maturity (most importantly, in terms of libraries available) - in other words, they's still hobby languages as of now. I have the suspicion that if a new language will become an established one, it will still take "not few" years, not less than 5/10, unfortunately. I like to use Lambda languages support as an indicator :)
- skohan 4y agoTotally agree. I think Rust advocates can be quite myopic, and tend to frame Rust's advantages relative to C++ or Python/JS in particular. But there are a great many languages which are more productive than Rust, and don't have some of the specific relative drawbacks that C++ or Python do. I really enjoy programming in Rust, but it's undeniable it makes tradeoffs in terms of productivity for the unique value proposition it presents. The idea that Rust should be used to implement every CRUD webservice, or that Rust -> wasm should be used to implement every web app just seems like irrational exuberance to me.
- Zababa 4y agoGo or even Java. The author talks about how they think Option would reduce errors. Turns out Java has Option. In fact, lots of languages have Option and don't come with all the Rust stuff that you may or may not need. For backend servers, often throwing a GC at it is fine.
- paavohtl 4y ago> Turns out Java has Option. While still having nulls everywhere. Rust doesn't have the concept of null at all - Option is the only way to represent the non-existence of something.
- Zababa 4y agoRust has a concept of null, though there are way more nulls in regular Java code than in regular Rust code: https://doc.rust-lang.org/std/ptr/fn.null.html https://doc.rust-lang.org/std/ptr/fn.null.html. If the issue is representing non-existence, Kotlin, C# and TypeScript (configured properly) all have nullable types. There's a good chance you'll be more productive with those instead of Rust for regular backends. Of course using Rust still makes sense when you need great performance and/or great safety for a specific service.
- paavohtl 4y ago> Rust has a concept of null, though there are way more nulls in regular Java code than in regular Rust code: https://doc.rust-lang.org/std/ptr/fn.null.html https://doc.rust-lang.org/std/ptr/fn.null.html. I've used Rust for about 6 years now, and I don't think I've ever used ptr::null(), mainly because I don't really write low-level wrappers around C libraries. I'd argue Rust does not have null as a concept or language feature - ptr::null() is just a convenience function for creating a pointer with the value of zero. The point of not having null is that in most languages null can appear basically in any variable or value, while in Rust null pointers can only exist when writing very low level potentially memory unsafe code. > If the issue is representing non-existence, Kotlin, C# and TypeScript (configured properly) all have nullable types. They do indeed have nullable types, but at least in in C# and TypeScript (and probably in Kotlin because of JVM interop) non-nullability is basically a lint with zero runtime guarantees. That is often good enough, but it's still a far cry from an absolute 100% percent guarantee provided by not having nulls even as a concept. Having nulls is a problem you can't fix by adding features - you have to design the language and/or the runtime from scratch without them. > There's a good chance you'll be more productive with those instead of Rust for regular backends I'm not arguing against the productivity of these languages or demanding anyone writes anything in Rust. I mostly write TypeScript in my day job, and it is a practical and productive choice for the work we do (web frontends, backends and serverless services). I just want to inform people about the capabilities of Rust and correct misunderstandings.