6 ms·
A previous workplace experimented with Rust for internal services and the feedback was almost uniformly negative. Commonly cited reasons were the long compile t
by ferdowsi 5y ago
A previous workplace experimented with Rust for internal services and the feedback was almost uniformly negative. Commonly cited reasons were the long compile times, limited standard library, and generally unstable best practices. One interesting quote was "why are you forcing me to waste a bunch of time doing needless bookkeeping when I create and pass around a string?"
The blog post about "Why strings seem hard in Rust" was not met with excited reactions.
- spekcular 5y agoWhat language did the workplace decide to use instead?
- ostenning 5y agoInternal services? What problem were you trying to solve with Rust exactly? Personally I wouldn't be writing web services with Rust, I don't think the language was really designed with that problem set in mind.
- jrib 5y agoWhich problem sets would you say rust excels at?
- zarzavat 5y agoAs a replacement for C or C++ (except 3D games where the choice of language is dictated by the engine). Kernels, databases, CLI programs, toasters, native code Python modules, etc. As a replacement for Go if you want a comprehensive type system instead of a skinny one.
- FpUser 5y agoI use C++ for backend business servers and web services in particular with stellar results performance wise. Modern C++ along with the STL and loads of 3rd party libs makes rapid development of servers piece of cake.
- elcapitan 5y agoMay I ask, what are your go to 3rd party libraries for the web service part?
- pjmlp 5y agoNot the op, Wt and asio are two known ones. If you are into MS or AWS ecosystem there are also SDKs available for their clouds.
- FpUser 5y agoFor browser based applications (they're all single page web apps using json based RPC) I use cpp-httplib and rapid json. I use other as well but do not really want to get into details here. The ones I just mentioned should get you up and running in no time.
- elcapitan 5y agoThanks!
- oscargrouch 5y agoI think a lot of us with experience in "system languages" would acknowledge where Rust fits in. But there are a lot of people in IT with experience in other fields that gets on into the marketing sales pitch that is trendy since the Java days, and i'm not blaming the community of doing anything wrong here, giving its the expected behavior of tech communities nowadays. But there is this noise into how Rust is sugared that i dont think its true, in that its the first system language that is as productive as a mid-level normally GCed language like Java or Go while giving more control and performance. I think there is no language into that spot yet, but i think that something that follows Rust could achieve this (Its something in the middle of Rust and Swift). The control and performance are there, as happens to C++, but the productivity is basically the same, which is not very good as compared to other languages that target more of being productive than being in control. The control level pay out in the end in the quality of the final product, but it s not the best option for things that dont require the amount of control that C++ and Rust gives you. But the thing with Rust, C++, Zig, etc.. is that, when you need it, you need it. There are things that can only be done with those kind of languages, and often are very complex and high-performant piece of software. Its not for everyone, and you need a sort of commitment that you would only pay if you really need. So writing things like 'web services' on them is not optimal, and you should use languages like Go, Java et al. for this. Tech people should be able to navigate hype and marketing lingo and see the things for what they are, i think is the same that is happening with 'web3' right now.
- zozbot234 5y ago> The control and performance are there, as happens to C++, but the productivity is basically the same This is not very fair to Rust. It's absolutely more productive than C++ when you account for the productivity benefits of "not shooting yourself in the foot" with pesky memory-safety bugs. Let's not even talk about scripting tools like Python, Ruby or JS that were never designed for "programming in the large" yet have somehow become popular in that role (with predictable consequences wrt. technical debt and lack of long-term maintainability). The proper, challenging comparison is with correctness-oriented GC languages like Haskell, OCaml, possibly F#. And Rust might nonetheless have the better community, since it can address systems-level and performance concerns out of the box unlike those.
- zozbot234 5y ago> "why are you forcing me to waste a bunch of time doing needless bookkeeping when I create and pass around a string?" Rust does not force you to do this. You can in fact pass around `String`, `Vec<…>` etc, and Rust will use move semantics to make it reasonably efficient. Of course using &str and &[…] is the proper "zero overhead" solution, but it does require some extra effort.
- tmp538394722 5y agoJust guessing, but speaking from my own experience, the trouble came when interacting with existing APIs, where you can’t choose what to pass around. Some expect String while others expect &str. Once you understand why, it’s easy to intuit which one should be used where, but it was a day 1 speed bump for me.
- nextaccountic 5y agoIf you have a String, passing a &str is free, you just.. put a & before your string. that's because if you expect a &str and pass a &String, the &String auto-derefs to &str. This is called a deref coercion[0] Like, if you have fn f(s: &str), you can do: let x: String = String::from(something); f(&x); You can see this in playground here [1] (click "Run") To explain: both String and &str is essentially a pointer plus metadata, but &String is a double pointer (a pointer to a pointer). Rust knows how to convert double pointers to pointers, using the Deref trait. This implicit conversion is applied only in a handful of places, and only if it doesn't lead to any ambiguity (if f received a generic parameter it wouldn't work for example). If you wanted to convert String to &str explictly, you would need to write &*x, like this (see in the playground here [2]): let x: String = String::from(something); f(&*x); That's because if x has type String, *x has type str (because String impls Deref<Target = str> [3]) and &*x has type &str. This means that auto-deref changed your &x into &*x automatically. [0] https://doc.rust-lang.org/book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods https://doc.rust-lang.org/book/ch15-02-deref.html#implicit-d... [1] https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5589e478f958429cfbed3d85cb14ab12 https://play.rust-lang.org/?version=stable&mode=debug&editio... [2] https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ebb5da3211e3ac35ed44b39ba780fa58\\ https://play.rust-lang.org/?version=stable&mode=debug&editio...* [3] https://doc.rust-lang.org/alloc/string/struct.String.html#impl-Deref https://doc.rust-lang.org/alloc/string/struct.String.html#im...