TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why the developers who use Rust love it so much

135 pointsby cyber1almost 5 years ago

16 comments

nickm12almost 5 years ago
I love this quote from a friend of mine who was learning Rust:<p>&quot;It&#x27;s hard but I love it. Dealing with the compiler felt like being the novice in an old kung fu movie who spends day after day being tortured by his new master (rustc) for no apparent reason until one day it clicks and he realizes that he knows kung fu.&quot;
评论 #23438150 未加载
评论 #23438069 未加载
评论 #23438146 未加载
评论 #23438125 未加载
评论 #23437999 未加载
atoavalmost 5 years ago
Coding in Rust isn&#x27;t easy, but where it is hard it is hard in a good way. It is like being on a journey with a good friend, who deeply cares about not letting you shoot yourself into the foot and explains you why without judging you.<p>Even if Rust would be wiped off the face of the earth tomorrow, thr things I learned from it have definitly made me a much better programmer.
评论 #23437828 未加载
ncmncmalmost 5 years ago
Money quote: &quot;Rust benefits here that very few people are being forced to use Rust.&quot;<p>Probably more people pick up C++ for the first time, in any given week, than the total who use Rust in production today.<p>Rust also benefits from the limited historical baggage that comes with being new and incompatible. Unlike Java, which was in the same position, Rust adopted very few old mistakes, and especially unlike Java made few new ones. But as the language approaches industrial maturity (possibly within 10 years) early mistakes will become evident, and cruft will be seen to accumulate.<p>Rust designers have consciously chosen to keep the language&#x27;s abstraction capacity limited, which makes it more approachable, but reduces what is possible to express in libraries. Libraries possible, even easy in C++ cannot be coded in Rust. The language will adopt more new, powerful features as it matures, losing some of its approachability and coherence. But Rust has already passed a key milestone: there is little risk, anymore, that it could &quot;jump the shark&quot;.<p>The language is gunning for C++&#x27;s seat. Whether it becomes a viable alternative, industrially, is purely a numbers game: can it pick up users and uses fast enough? The libraries being coded in C++ today will never be callable from Rust.<p>Go proved that the world will make room for a less capable language (in Go&#x27;s case, than Java) if it is simpler. Rust is much more capable than C, Go, or Java, and the world would certainly be a better place if everybody coding those switched to Rust. So, my prediction is that Rust and C++ will coexist for decades. The most ambitious work will continue to be done in C++, but a growing number will have their first industrial coding experience in Rust instead of C, and many will find no reason to graduate to C++.
评论 #23437735 未加载
评论 #23437725 未加载
评论 #23437709 未加载
评论 #23437904 未加载
评论 #23438457 未加载
评论 #23438305 未加载
FlyingSnakealmost 5 years ago
Rust is a fantastic language, and once past the borrow checker level, it can be quite productive. One interesting compatriot of Rust is Swift, which also ticks most of the checks in that list. Also Swift has IMO a better development experience, due to Apple’s initiatives. I wonder what Rust developers think about swift.
评论 #23437762 未加载
评论 #23438163 未加载
评论 #23437684 未加载
评论 #23441384 未加载
评论 #23438070 未加载
Skunkletonalmost 5 years ago
Also: almost everyone who uses rust does so by their own choice.
评论 #23438319 未加载
评论 #23438086 未加载
评论 #23437807 未加载
评论 #23438021 未加载
smabiealmost 5 years ago
&quot;In type checking, only the signature of functions are considered. There’s no relying on the implementation for determining if callers are correct (like you can do in Scala, or Haskell)&quot;<p>What does this mean?
评论 #23437924 未加载
评论 #23437695 未加载
评论 #23438221 未加载
cassepipealmost 5 years ago
Rust is great but it could gain from explaining itself with memory and pointers or else why a String has the Clone trait and a u32 the Copy trait? I tried to learn it as a first language and it was hard until I started learning C, groking the stack the heap and pointers. I think all the tutorials out there are ill suited since they hide away so much. It&#x27;s harder to remember stuff if you don&#x27;t understand why it is that way, well at least it stands true for me. So I would love to see a Rust for beginners tutorial for C beginners. Maybe I&#x27;ll write it someday. I really got discouraged when it got into the ugly lifetime syntax. But I will definitely come back to it. (Unless Zig shows to be just as safe and less verbose)
评论 #23462808 未加载
turbinerneiteralmost 5 years ago
It feels like being part of a village that learns to love the dragon it battles.
评论 #23439840 未加载
devitalmost 5 years ago
It&#x27;s the only production-ready language that is both memory safe and has zero-cost abstractions (i.e. for any C code you have Rust code that compiles to equivalent assembly, and using more abstractions in Rust does not make the assembly less efficient unless the abstraction can&#x27;t be implemented otherwise).<p>Also as long as you accept not having dependent types (at least for the short and mid-term) and several currently unimplemented features, Rust is the optimal way a programming language can be designed other than assorted minor warts.
评论 #23439829 未加载
orthoxeroxalmost 5 years ago
It&#x27;s a niche language that dominates its niche.<p>I wouldn&#x27;t write a LoB application in Rust, for example. But if I wrote programs with really tight speed and memory requirements for a living, I would pick Rust for the task.<p>If people were forced to write their website backends in Rust (or even their frontends in Rust targeting WASM) they would hate it. Its performance is overkill for 99.9% of backends, but the means of getting this performance kill your productivity.
评论 #23439747 未加载
评论 #23440352 未加载
评论 #23438904 未加载
robotmayalmost 5 years ago
I&#x27;ve been casually playing with Rust for a few years now. Wrote a few small things in my previous job that still run a large part of their business, which is pretty satisfying, but only very recently have I found a couple of hobby projects where it just feels like the right tool for the job (for me). Web stuff I&#x27;d still much rather write in Ruby, if I&#x27;m honest, but for playing around on systems Rust is super fun. I ended up making <a href="https:&#x2F;&#x2F;git.sr.ht&#x2F;~robotmay&#x2F;amdgpu-fancontrol" rel="nofollow">https:&#x2F;&#x2F;git.sr.ht&#x2F;~robotmay&#x2F;amdgpu-fancontrol</a>, of which there&#x27;s already an equivalent in Python, but the lack of dependencies when installing a piece of Rust software makes it feel very portable and neat.<p>My favourite metaphor for Rust is that it&#x27;s like a friendly bare-knuckle fist-fight with the compiler. It&#x27;s not as user-friendly as, say, Elm, but it&#x27;s streets ahead of Haskell&#x27;s errors.
评论 #23438748 未加载
kumarvvralmost 5 years ago
A newbie question.<p>As a seasoned C#, Python and JS programmer, what conceptual foundations in CS will make me use rust more effectively?<p>Say I want to create a new database service, on top of Postgresql, using rust. Would the design of rust help me in a specific way?<p>I want to learn and use rust, for systems programming, the kind where I build a high performance underlying system, called by other languages, but it always feels I need to learn quite a bit of theory to <i>effectively</i> use rust.<p>I never felt the same with C# or python. A bit of OO stuff was usually enough to be productive with them.
lbjalmost 5 years ago
Where&#x27;s a good place to start with Rust? Which domains is it particularly good in ?
andi999almost 5 years ago
Also the same reason why ppl love c++: Stockholm syndrom.
评论 #23438439 未加载
评论 #23438216 未加载
评论 #23443290 未加载
moonchildalmost 5 years ago
I don&#x27;t believe that rust solves the right problems in the right ways. This is specifically with respect to the single-owner raii&#x2F;lifetime system; the rest of the language is imo pretty nice (aside from the error messages, which are an implementation problem).<p>For starters, ATS[1] and f-star[2] both provide much stronger safety guarantees, so if you want the strongest possible guarantees that your low-level code is correct, you can&#x27;t stop at rust.<p><pre><code> _____________________________________________ </code></pre> Beyond that, it&#x27;s helpful to look at the bigger picture of what characteristics a program needs to have, and what characteristics a language can have to help facilitate that. I propose that there are broadly three program characteristics that are affected by a language&#x27;s ownership&#x2F;lifetime system: throughput, resource use, and ease of use&#x2F;correctness. That is: how long does the code take to run, how much memory does it use, and how likely is it to do the right thing &#x2F; how much work does it take to massage your code to be accepted by the compiler. This last is admittedly rather nebulous. It depends quite a lot on an individual&#x27;s experience with a given language, as well as overall experience and attention to detail. Even leaving aside specific language experience, different individuals may rank different languages differently, simply due to different approaches and thinking styles. So I hope you will forgive my speaking a little bit generally and loosely about the topic of ease-of-use&#x2F;correctness.<p>The primary resource that programs need to manage is memory[3]. We have several strategies for managing memory:<p>(Note: implicit&#x2F;explicit below refers to whether something something is an explicit part of the type system, not an explicit part of user code.)<p>- implicitly managed global heap, as with malloc&#x2F;free in c<p>- implicit stack-based raii with automatically freed memory, as in c++, or c with alloca (note: though this is not usually a general-purpose solution, it can be[4]. But more interestingly, it can be composed with other strategies.)<p>- explicitly managed single-owner abstraction over the global heap and possible the stack, as in rust<p>- explicit automatic reference counting as an abstraction over the global heap and possibly the stack, as in swift<p>- implicit memory pools&#x2F;regions<p>- explicit automatic tracing garbage collector as an abstraction over the global heap, possibly the stack, possibly memory regions (as in a nursery gc), possible a compactor (as in a compacting gc). (Java)<p>- custom allocators, which may have arbitrarily complicated designs, be arbitrarily composed, arbitrarily explicit, etc. Not possible to enumerate them all here.<p>I mentioned before there are three attributes relevant to a memory management scheme. But there is a separate axis along which we have to consider each one: worst case vs average case. A tracing GC will usually have higher throughput than an automatic reference counter, but the automatic reference counter will usually have very consistent performance. On the other hand, an automatic reference counter is usually implemented on top of something like malloc. Garbage collectors generally need a bigger heap than malloc, but malloc has a pathological fragmentation problem which a compacting garbage collector is able to avoid.<p>This comment is getting very long already, and comparing all of the above systems would be out of scope. But I&#x27;ll make a few specific observations and field further arguments as they come:<p>- Because of the fragmentation problem mentioned above, memory pools and special-purpose allocators will always outperform a malloc-based system both in resource usage and throughput (memory management is constant-time + better cache coherency)<p>- Additionally, implicitly managed memory pools are usually easier to use than an implicitly managed global heap, because you don&#x27;t have to think about the lifetime of each individual object.<p>- Implicit malloc&#x2F;free in c should generally perform similarly to an explicit single-owner system like rust&#x27;s, because most of the allocation time is spent in malloc, and they have little (or no) runtime performance hit on top of that. The implicit system may have a slight edge because it has more flexible data structures; then again, the explicit single-owner system may have a slight edge because it has more opportunity to allocate locally defined objects directly on the stack if their ownership is not given away. But these are marginal gains either way.<p>- Naïve reference counting will involve a significant performance hit compared to any of the above systems. <i>However</i>, there is a heavy caveat. Consider what happens if you take your single-owner verified code, remove all the lifetime annotations, and give it to a reference-counting compiler. Assuming it has access to all your source code (which is a reasonable assumption; the single-owner compiler has that), then if it performs even <i>basic</i> optimizations—this isn&#x27;t a sufficiently smart compiler[5]-type case—it will elide all the reference counting overhead. Granted, most reference-counted code isn&#x27;t written like this, but it means that reference counting isn&#x27;t a performance dead end, and it&#x27;s not difficult to squeeze your rc code to remove some of the rc overhead if you have to.<p>- It&#x27;s possible to have shared mutable references, but forbid sharing them across threads.<p>- The flexibility gains from having shared mutable references are not trivial, and can significantly improve ease of use.<p>- Correctness improvements from strictly defined lifetimes are a myth. Lifetimes aren&#x27;t an inherent part of any algorithm, they&#x27;re an artifact of the fact that computers have limited memory and need to reuse it.<p>To summarize:<p>- When maximum performance is needed, pools or special-purpose allocators will always beat single-owner systems.<p>- For all other cases, the performance cap on reference counting is identical with single-owner systems, while the flexibility cap is much higher.<p><pre><code> _____________________________________________ </code></pre> 1. <a href="http:&#x2F;&#x2F;www.ats-lang.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.ats-lang.org&#x2F;</a><p>2. <a href="https:&#x2F;&#x2F;fstar-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fstar-lang.org&#x2F;</a><p>3. File handles and mutex locks also come up, but those require different strategies. Happy to talk about those too, but tl;dr file handles should be avoided where possible and refcounted where not; mutexes should also be avoided where possible, and be scoped where not.<p>4. <a href="https:&#x2F;&#x2F;degaz.io&#x2F;blog&#x2F;632020&#x2F;post.html" rel="nofollow">https:&#x2F;&#x2F;degaz.io&#x2F;blog&#x2F;632020&#x2F;post.html</a><p>5. <a href="https:&#x2F;&#x2F;wiki.c2.com&#x2F;?SufficientlySmartCompiler" rel="nofollow">https:&#x2F;&#x2F;wiki.c2.com&#x2F;?SufficientlySmartCompiler</a>
评论 #23438140 未加载
评论 #23437890 未加载
dirtydroogalmost 5 years ago
Never before has a programming language received so much marketing. It&#x27;s very odd.
评论 #23438020 未加载
评论 #23437876 未加载
评论 #23438361 未加载