3 ms·
Why Learn Rust?
- LarsDu88 4y agoJust a little blog post on my journey to both learn Rust and understand why it's the most loved programming language.
- chrsig 4y agohow have you quantified love?
- BuckRogers 4y agoHe’s referencing the article which cites its own sources.
- LarsDu88 4y agoWith barplots in the article my friend
- BuckRogers 4y agoRust is the most interesting programming language that I probably will never use. I found it amusing that the author kind of hinted at the same thing at the end himself. There’s probably a lot of people in that boat. It’s definitely my systems language of choice, but I can’t say I am experienced enough and true systems, languages to have my opinion carry any real weight. I would suspect that the massive ecosystem built around C++ means that you can get it more done with it faster with less frustration. Even so, having no experience with either one of those, I would have to go with Rust due to memory safety. It’s good to watch the rest ecosystem grow and adoption increase. It looks like Microsoft is essentially endorsing it as their primary system language if they have the option.
- LarsDu88 4y agoIt's my systems programming language of choice, but I simply don't do systems programming right now. If I needed to slot it into python, I'd probably go through numba first rather than pyo3, for example
- turtleyacht 4y agoAnyone see Rust and think, "Well, yes--it would make me super productive in projects where I'd use it. But I want to build the tools that I'd write the app in." That inane, insane (prideful?) complex that sucks the time we won't ever get back, forcing us to vintage consoles, obsolete hardware, the oldest books--chasing some Ur-experience where finally, at the end of that journey, on the docks of Middle Earth, we can finally step onto the boat that will take us to the land of the ageless. For some definition of solemn purity, to work after already-solved problems, in order to understand the beneath: even as things race forward, incessant, and we moor to the mad calm of executing the projects we smash our minds upon.
- restalis 4y agoBesides what I've already said about Rust in the past¹, the only thing that I understand Rust has over C++ is additional cross-checks, performed at every compilation. In C++ these kind of additional expensive operations are covered by optional 3rd party tools, in this particular case by static code analyzers. There is a good (i.e. useful) reason to engineer the compilation in such separate steps. Of course, the option of having the entire batch of operations tightly integrated has benefits (as well as drawbacks), but that's just about it. ¹ https://news.ycombinator.com/item?id=31565024 https://news.ycombinator.com/item?id=31565024
- AlotOfReading 4y agoAre you kidding? Just one very obvious example: Rust has had good interfaces for std:: optional and std::expected since v1. C++ is finally getting them in c++23 and c++26 (maybe) respectively. Moreover, you only have to learn Rust once because the language doesn't have nearly the same number of weird limitations and radical overhauls every 3 years. I attend the conferences and write C++ regularly. I still run into issues when reviewing teams where I have to consult the standard because I'm not sure if some weird construct is valid because everyone has their own subset of C++ they're comfortable with. God forbid you have to onboard someone new to the language and explain all the different kinds of initialization, a topic that's utterly trivial in literally any other language. As an aside, static code analyzers are not able to provide the same kind of guarantees rustc does to arbitrary C++.
- restalis 4y ago"As an aside, static code analyzers are not able to provide the same kind of guarantees rustc does to arbitrary C++." Yes, and now the question becomes - is this due to hard limitations of the C++ as a language (in the sense that provision of such guarantees is simply impossible for static code analyzers, no matter what), or is it that static code analyzers just didn't provide so far (but can and most likely will)? I personally recognize and am thankful for Rust's effort to raise general awareness on the safeness aspect. This (awareness rising) would have been indeed hard to do without forcing this safety to the language core design, although I don't see it working well for Rust in the long run (after people will start having quality alternatives and won't have to pay the "safe by default" price that Rust asks of them).
- hot_gril 4y agoThe idea of "switching" from Python to Rust is strange. They aren't really used for the same tasks. Rust is an alternative to C, C++, and to some extent Swift and Golang. And a very good one.
- MrJohz 4y agoHonestly, I'm increasingly sceptical on this point. If your developers are comfortable writing Rust (and in fairness, this is a big "if", particularly with junior developers), then I think you can use Rust as a fairly high-level language, and it will quite happily replace Python or Ruby if you want it to. Recently at my job, we started a new project in Python, which worked fairly well, but the code runs in a somewhat constrained environment. Out of interest, I rewrote the whole project in Rust in about two days, and implemented a big new feature in another day. What I found was that the code ran ~10× as fast, but it was, if anything, even simpler to implement than in Python. Part of that was probably the rewrite effect, and part was definitely the web framework (Warp), but I found I was still mostly writing fairly high-level code. On top of that, when I had to drop down into using more natural synchronisation primitives, it was very easy to (a) do that and (b) wrap that low-level code in a high-level abstraction. In the end, we decided not to go down this route, mainly because others in the team were less confident about using Rust, but it was, for me at least, a really impressive example of how one can get a lot of the benefits of low level languages with relatively little development cost by using Rust. We probably noticed more of a benefit because of the more constrained environment (although bear in mind, the python alternative had been working just fine for us up until then), but even still, a quicker implementation means less hardware, which means cheaper costs - if you can do that without much effort, that's a pretty good trade-off!
- hot_gril 4y agoI don't think Rust is a lower-level language exactly, but it can be more cumbersome for high-level code than something like Python that has GC, duck-typing, and short-hands for things like generators and list comprehension. For a web backend, I'd actually prefer NodeJS, but you mention a constrained environment and synchronization primitives, which both sound unusual for that application. When I used Rust, the entire purpose of the project was performance. It was a software-defined networking middlebox that's part of LTE networks. But we were doing FFI with C code. Rust was better for the larger concurrent pieces, but I still liked writing in C better for the fine-grained stuff (packet parsers etc).
- thdespou 4y agoWhy not learn C the proper way? modern C 11 has really good features.
- tmtvl 4y agoYeah, C17 is pretty nice and C23 is shaping up to be really amazing.