TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

My negative views on Rust (2023)

192 点作者 rc008 个月前

20 条评论

jkelleyrtp8 个月前
&quot;There are only two kinds of languages: the ones people complain about and the ones nobody uses&quot;.<p>---<p>Glad to see fluffy negative articles about Rust shooting up the first slot of HN in 20 minutes. It means Rust has made finally made it mainstream :)<p>---<p>The points, addressed, I guess?<p>- Rust has panics, and this is bad: ...okay? Nobody is writing panic handling code, it&#x27;s not a form of error handling<p>- Rust inserts Copy, Drop, Deref for you: it would be really annoying to write Rust if you had to call `.copy()` on every bool&#x2F;int&#x2F;char. A language like this exists, I&#x27;m sure, but this hasn&#x27;t stopped Rust from taking off<p>- Fetishization of Efficient Memory Representation: ... I don&#x27;t understand what the point is here. Some people care about avoiding heap allocations? They&#x27;re a tool just like anything else<p>- Rewrite anything and it gets faster: okay sure, but there are limits to how fast I can make a Py&#x2F;JS algorithm vs a compiled language, and Rust makes writing compiled code a bit easier. People probably aren&#x27;t rewriting slow Python projects in C these days<p>- Rust is as complex as C++: ...no, it&#x27;s not. Rust really hasn&#x27;t changed much in the past 6 years. A few limitations being lifted, but nothing majorly new.<p>- Rust isn&#x27;t as nice of community as people think: subjective maybe? People are nice to me at conferences and in discussion rooms. There&#x27;s occasional drama here and there but overall it&#x27;s been pretty quiet for the past year.<p>- Async is problematic: Async Rust really is fine. There&#x27;s a huge meme about how bad it is, but really, it&#x27;s fine. As a framework author, it&#x27;s great, actually. I can wrap futures in a custom Poll. I can drive executors from a window event loop. Tokio&#x27;s default choice of making `spawn` take Send&#x2F;Sync futures is an odd one - occasionally cryptic compile errors - but you don&#x27;t need to use that default.<p>I&#x27;m unsure why this article is so upvoted given how vapid the content is, but it does have a snappy title, I guess.
评论 #41792720 未加载
评论 #41792677 未加载
评论 #41794044 未加载
评论 #41793895 未加载
评论 #41792708 未加载
评论 #41794054 未加载
评论 #41793147 未加载
评论 #41798770 未加载
评论 #41796014 未加载
评论 #41794371 未加载
评论 #41793993 未加载
评论 #41798469 未加载
评论 #41793442 未加载
评论 #41792924 未加载
Animats8 个月前
My big problem with Rust is too much &quot;unsafe&quot; code. Every time I&#x27;ve had to debug a hard problem, it&#x27;s been in unsafe code in someone else&#x27;s crate. Or in something that was C underneath. I&#x27;m about 50,000 lines of Rust into a metaverse client, and my own code has zero &quot;unsafe&quot;. I&#x27;m not even calling &quot;mem&quot;, or transmuting anything. Yet this has both networking and graphics, and goes fast. I just do not see why people seem to use &quot;unsafe&quot; so much.<p>Rust does need a better way to do backlinks. You can do it with Rc, RefCell, and Weak, but it involves run-time borrow checks that should never fail. Those should be checked at compile time. Detecting a double borrow is the same problem as detecting a double lock of a mutex by one thread, which is being worked on.
评论 #41792980 未加载
评论 #41793613 未加载
评论 #41792559 未加载
评论 #41792625 未加载
评论 #41797618 未加载
评论 #41792733 未加载
评论 #41797722 未加载
评论 #41794510 未加载
评论 #41792531 未加载
评论 #41792726 未加载
hyperbrainer8 个月前
Needs (2023)<p>&gt; I predict that tracing garbage collectors will become popular in Rust eventually.<p>The use of Rc is already very widespread in projects when people don&#x27;t want to deal with the borrow checker and only want to use the ML-like features of Rust (Sum types, Option, Error etc.)<p>&gt; Rust has arrived at the complexity of Haskell and C++, each year requiring more knowledge to keep up with the latest and greatest.<p>I wonder when we will see the rise of Haskell like LanguageExtensions in Rust. AFAIK, pretty much everybody uses things like GADT, PolyKinds, OverloadedStrings etc. The most similar thing I can think of Rust right now for is python-like decorator application of things like builder macros using Bon.<p>&gt; Async is highly problematic<p>Agreed. Tokyo is the only reason, I think, anybody is able to use Rust for this stuff.
评论 #41792504 未加载
评论 #41793472 未加载
评论 #41792560 未加载
sebastos8 个月前
&quot;X is as complex as C++&quot; is a preposterous statement for all values of X.<p>A lot of people seem to assume that &quot;C++ is complex&quot; is referring to how the committee adds new language features every 3 years. The conventional wisdom that C++ is wickedly difficult to learn is NOT about &quot;oh man, now I need to learn about the spaceship operator?&quot; C++ is an almost unfathomably bottomless pit. From the arcane template metaprogramming system to the sprawling byzantine rules that govern what members a compiler auto-generates for you, and on to the insane mapping between &quot;what this keyword was originally introduced for&quot; and &quot;what it actually means here in _this_ context, there is no end to it. Keeping up with new language syntax features is an absolute drop in the bucket compared to the inherent complexity required to understand a C++11 codebase, build it (with a completely separate tool that you must choose) and manage its dependencies (with a yet different completely separate tool that you must choose).<p>You don&#x27;t have to know anything about Rust to know that saying &quot;Rust has become complex as C++&quot; is objectively incorrect.
评论 #41798579 未加载
评论 #41794595 未加载
umanwizard8 个月前
&gt; Distinguishing mutability has its advantages<p>I think it&#x27;s misleading to say that Rust distinguishes mutability. It distinguishes _exclusivity_. If you hold a reference to something, you are guaranteed that nothing else holds an exclusive reference to it (which is spelled &amp;mut). You are _not_ guaranteed that nothing accessible through that reference can change (for example, it might contain a RefCell or other interior-mutable type). Shared references (spelled &amp;) usually imply immutability, but not always. On the other hand, if you hold an exclusive reference to something, you are guaranteed that nothing, anywhere, holds any kind of reference to it.<p>IMO, the fact that exclusive references are spelled &quot;&amp;mut&quot;, and often colloquially called &quot;mutable references&quot;, was a pedagogical mistake that we&#x27;re unfortunately now stuck with.
评论 #41794136 未加载
lll-o-lll8 个月前
&gt; People waste time on trivialities that will never make a difference.<p>This is an aha moment as I read it. The complexity of your tools must be paid back by the value they give to the business you’re in.
评论 #41794254 未加载
评论 #41794197 未加载
评论 #41792485 未加载
henning8 个月前
&gt; People waste time on trivialities that will never make a difference.<p>Depending on the situation, memory layout could be trivial (copying 200 bytes once at startup vs. not in a way that should never be user-perceptible and difficult to even measure) or actually a big deal (chasing down pointers upon pointers in a tight inner loop). It&#x27;s entirely situational. To dismiss all of that as &quot;trivial&quot; and saying it will &quot;never&quot; make a difference is not helpful. There are a lot of shitty apps that are impossible to get running reasonably without a total rewrite and their shitty use of memory is part of that.
评论 #41792368 未加载
评论 #41792546 未加载
评论 #41792358 未加载
pcwalton8 个月前
I actually used to agree that Rust generally wasn&#x27;t good for high-level application code, but working with Bevy has made me change that opinion for certain domains. I simply haven&#x27;t seen a system that makes automatically parallelizing all application logic (game logic, in this case) feasible, other than Bevy and other Rust-based systems. The trick is that the borrow check gives the scheduler enough information to automatically safely determine which systems can run in parallel, and that&#x27;s very powerful. It&#x27;s not that you <i>couldn&#x27;t</i> do this in C# or whatever--it&#x27;s that you <i>won&#x27;t</i> without a system that helps express your intent and enforces that those declarations are up to date.<p>For applications that don&#x27;t need high performance for the CPU code <i>and</i> aren&#x27;t systems code, sure, Rust may not be a good choice. I&#x27;m not writing the server-side code for low traffic Web sites in Rust either.
评论 #41794159 未加载
drogus8 个月前
It&#x27;s funny when people mention Go as the gold standard of not adding features to the language and Rust as ever-changing when Rust hasn&#x27;t introduced any major changes in at least 3-4 years and Go introduced a major paradigm shift in how people structure their code (generics).<p>Before you start replying with &quot;Rust introduced X&quot; - ask yourself - is X extending an existing feature slightly or does it introduce an entirely new concept?
评论 #41794034 未加载
评论 #41797736 未加载
评论 #41794237 未加载
jeffreyrogers8 个月前
I learned to program around the peak of object oriented fetishization. Shortly after that came functional programming&#x27;s moment, and now it seems we are slightly past Rust and other safety focused languages&#x27; peak period of hype. All three language families have useful things to offer, but were never the panacea their proponents claimed them to be. &quot;No Silver Bullet&quot; continues to be true.
dang8 个月前
Related:<p><i>My negative views on Rust</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29659056">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29659056</a> - Dec 2021 (89 comments)
rich_sasha8 个月前
I think to some extent Rust is a victim of its own unreasonable effectiveness. It is great at its narrow niche of memory safe low level programming, but frankly pretty good at lots of other things. But at these other applications some of its design principles get in the way - like the pedantic borrow checker. Languages not used outside their niches don&#x27;t tend to collect such criticism.<p>Python is a bit like that. It is a top choice for a few things, and ends up used effectively for other things, simply because it is versatile. But then people run into issues with dynamic typing, zero static safety, start slapping type annotations everywhere... and bemoan Python as a bit of a horror show.<p>My use case for Rust is complementing Python, where frankly I don&#x27;t care about half the complex features, still it&#x27;s nicer than C or C++ to code in. The complexities of the borrow checker are more like a tax to me. I understand people who are frustrated with it thought, as otherwise they see it as a bit of a perfect language.
评论 #41794262 未加载
评论 #41802819 未加载
评论 #41793284 未加载
lacker8 个月前
I like Rust but at the same time I agree with the points here. These things are indeed problems with Rust.<p>Nevertheless, C++ has even worse problems. When your alternative is using C++, that&#x27;s the time to consider Rust.
评论 #41802483 未加载
MuffinFlavored8 个月前
Who uses panic instead of `?` and anyhow &#x2F; Box&lt;dyn Error&gt; (error propagation?)<p>I think there is even a (gross) way to achieve try&#x2F;catch around a block of code that panics?
评论 #41793200 未加载
egnehots8 个月前
Some points resonate with me:<p>&gt; People don&#x27;t want &quot;to have to play Chess against the compiler&quot;<p>Things that are easy to express in other languages become very hard in Rust due to the languages constraints on ownership, async...<p>&gt; Rust has arrived at the complexity of Haskell and C++, each year requiring more knowledge to keep up with the latest and greatest.<p>It&#x27;s indeed hard to keep up.<p>&gt; Async is highly problematic.<p>Yes, more complexity, more fragmentation and feel like another language.<p>But one point feels unfair:<p>&gt; the excellent tooling and dev team for Rust [..] pulls the wool over people’s eyes and convinces them that this is a good language that is simple and worth investing in.<p>What? No. The main appeal was the safety. It&#x27;s still a distinctive feature of Rust. To almost eliminate a whole class of safety issues. It has been proven by several lengthy reports such as <a href="https:&#x2F;&#x2F;security.googleblog.com&#x2F;2024&#x2F;09&#x2F;eliminating-memory-safety-vulnerabilities-Android.html" rel="nofollow">https:&#x2F;&#x2F;security.googleblog.com&#x2F;2024&#x2F;09&#x2F;eliminating-memory-s...</a>.<p>They are many projects for which the reliability and efficiency are worth the trouble.
indulona8 个月前
i could buy an alphabet soup, add in some cereals, mix it up and throw it on the table, knowing it would end up looking indistinguishable from rust code.
评论 #41794634 未加载
dvektor8 个月前
I agree with a couple points here, specifically I agree that choosing a language based on it&#x27;s community (and not it&#x27;s ecosystem) is just silly. And we all know that async ended up being a bit of a thorn in rust&#x27;s side.<p>But yeah, rust is very much a systems language: so it will be forcing you to think about memory layout one way or the other. Idk how valid of a complaint that is when you really consider that, and specifically the other alternatives you have.
评论 #41792519 未加载
VeejayRampay8 个月前
rust is fine, it&#x27;s a solid mix of performance and expressiveness, it has good constructs and it&#x27;s gaining traction<p>it&#x27;s hard to learn so we shall see what kind of niche it can carve for itself, but it&#x27;s fine
评论 #41792548 未加载
IshKebab8 个月前
So much to disagree with....<p>&gt; In practice, people just want to be able to write a tree-like type without having to play Chess against the compiler.<p>Sure, Rust&#x27;s strong encouragement of tree-structured ownership may be annoying when you try and make a spaghetti ownership soup, but it&#x27;s not like it doesn&#x27;t have upsides. Many people have written about how the ownership &amp; borrowing rules lead to code structure that has fewer bugs.<p>&gt; I think that if you rewrite anything from scratch with performance in mind, you’ll see a significant performance improvement.<p>Maybe, but I think this is missing the point. The &quot;rewrote it in Rust and it&#x27;s X times faster&quot; stories are generally when people rewrite from very slow (Python) or medium fast languages (JavaScript or maybe even Go).<p>In those cases you can rewrite in Rust <i>without</i> considering performance and get amazing speedups. I recently did a straight 1:1 port of some Python code with zero extra optimisation effort and got a 45x speedup.<p>Sure I maybe could have got the same in C or C++ but there&#x27;s no way I would have rewritten it in C++ because fuck segfaults and UB. I don&#x27;t want to spend any more of my life debugging that.<p>&gt; Rust has arrived at the complexity of Haskell and C++, each year requiring more knowledge to keep up with the latest and greatest.<p>I don&#x27;t really know about Haskell, but I don&#x27;t think Rust&#x27;s complexity is anywhere close to as bad as C++&#x27;s. Even if it were it doesn&#x27;t matter because in Rust if you forget some complex rule the compiler will tell you, whereas in C++ it will randomly crash but only in release mode after the program has been running for 2 hours. Totally different.<p>&gt; The “Friendly” Community<p>Gotta agree with this though. The &quot;we&#x27;re friendly&quot; thing is bullshit.<p>&gt; Async is highly problematic<p>Also agree here. Async is a huge wart on Rust&#x27;s otherwise relatively unblemished face. Big shame. Oh well. You can <i>mostly</i> avoid it, and there are some cases where it&#x27;s genuinely good (e.g. Embassy).<p>&gt; I feel like Rust is self-defined as a “systems” language, but it’s being used to write web apps and command-line tools and all sorts of things. &gt; &gt; This is a little disappointing, but also predictable: the more successful your language, the more people will use your language for things it wasn’t intended for.<p>I don&#x27;t see why he&#x27;s disappointed about this. Rust is great for command line tools and web backends.<p>&gt; I think that the excellent tooling and dev team for Rust, subsidized by Big Tech, pulls the wool over people’s eyes and convinces them that this is a good language that is simple and worth investing in. There’s danger in that type of thinking.<p>Ok this guy is not worth listening to.
评论 #41792563 未加载
评论 #41792418 未加载
DiabloD38 个月前
I&#x27;ve read this before, it&#x27;s been passed around the Rust community a few times.<p>The annotated tl;dr is: Chris doesn&#x27;t want to learn how hardware works, they don&#x27;t want to learn how to write optimal software, they don&#x27;t want to write safe software, they just want to write in a language they already know because they&#x27;re not comfortable with learning other languages because their home language is a functional language (Haskell). It&#x27;s a weird, yet short, essay that doesn&#x27;t actually go anywhere.<p>I suspect Chris wrote the essay against their will, or because people asking them about Rust rubbed them the wrong way, because they lash out and say &quot;This post still offends many who have tied Rust to their identity, but that’s their problem, not mine.&quot;<p>Its the Internet, man, if you&#x27;re not offending someone, nobody is reading your shit.
评论 #41793092 未加载
评论 #41792514 未加载
评论 #41792541 未加载
评论 #41793880 未加载