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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Rust is for Professionals

138 点作者 indygreg2大约 4 年前

21 条评论

skohan大约 4 年前
Rust is currently my favorite language for personal projects. It&#x27;s got a very good value proposition in terms of giving some high level features along with low level control and performance, great compatibility story, and the tooling and community is absolutely great.<p><i>However</i>, as the manager of a technical team, I would not choose it for professional projects. The learning curve is very steep, and to reap the benefits you have to pay a high cost in terms of accepting additional complexity. I think Rust is a good choice for <i>some</i> professional use-cases, for instance performance-sensitive applications like embedded, or safety-critical applications. But for many applications, like your average webserver for example, I believe you will lose productivity and have a hard time hiring if you choose Rust.<p>For my team, we chose Go because it is easy to hire and onboard people, the tooling and compatibility story is plenty good enough, and due to the complexity ceiling, there&#x27;s only so much damage a developer can do in terms of taking the codebase in a bad direction.<p>Rust is a capable language for a professional setting, but it is also a language ideally suited for people who enjoy indulging in complexity and tricky problem solving, and this is not the right choice for every project or team.
评论 #26794721 未加载
评论 #26794925 未加载
评论 #26794558 未加载
评论 #26797807 未加载
ahelwer大约 4 年前
Here I am on day three of an attempt to modify a rust program with logic that would have taken about twenty minutes to implement in C# or Java. It has to do with operations on strings (use a regex to find a string in some text, escape all the regex-reserved characters in that string, then use the string as a regex to find other occurrences of itself in the text) so I get that I&#x27;m really thrown into the borrow-checker deep-end, but man writing rust feels like working on one of those puzzles where you try to fit a set of tiles inside a rectangle. You&#x27;ll almost get it but then some edge is sticking out. So you move the tiles around but this leads to two edges sticking out now! So you do a whole bunch of additional exploring before ending up right back where you started with the one edge sticking out.<p>I even abandoned the learn-by-stackoverflow-search approach to rust and read the first seven or so chapters of the rust book. But even that hasn&#x27;t helped very much. I know I am just currently in the painful, frustrating stage of learning where nothing really makes sense, and at some future point it will all click, but it really can&#x27;t be overstated just what a wicked learning curve this language has.
评论 #26794365 未加载
评论 #26794465 未加载
评论 #26794336 未加载
评论 #26795106 未加载
评论 #26794447 未加载
评论 #26794487 未加载
评论 #26794952 未加载
评论 #26795811 未加载
评论 #26795151 未加载
评论 #26800565 未加载
评论 #26794514 未加载
评论 #26794443 未加载
评论 #26794385 未加载
yagizdegirmenci大约 4 年前
&gt; Rust Makes You a Better Overall Programmer<p>I agree with that, but this applied to nearly any language for me. I started doing Python back when 2013, then i learned Go, i started writing better Python code, then i learned C, i started writing better Go code, then i learned Rust, i started writing better code in general. The more you play with other language the more you learn other programming paradigms, it changes the way you thinking about programming completely.
评论 #26794885 未加载
judofyr大约 4 年前
This is a nice summary of the good features of Rust, but I&#x27;m failing to see how any of these points are in any way special for a &quot;professional programmer&quot;. Doesn&#x27;t a hobby programmer care about all of these points as well?<p>In my experience, whether you&#x27;re getting paid or not correlates quite poorly with the requirements of the project. I&#x27;ve worked on professional code bases where bugs were totally acceptable (&quot;just push a fix when the error comes in&quot;), and I&#x27;ve done open-source projects where I definitely don&#x27;t want anything to break (&quot;I&#x27;d hate to release a broken version&quot;).<p>&gt; The statement Rust is for Professionals does not imply any logical variant thereof. e.g. I am not implying Rust is not for non-professionals. Rather, the subject&#x2F;thesis merely defines the audience I want to speak to: people who spend a lot of time authoring, maintaining, and supporting software and are invested in its longer-term outcomes.<p>Well, it looks like you&#x27;re implying <i>some</i> logical variants, like &quot;Rust is a better language than language X for professionals&quot; or &quot;Language Y is _not_ a language for professionals&quot;. I mean, &quot;Language X is for Professionals&quot; is true (by observation) for every single language out there being used professionally.
pizza234大约 4 年前
While I&#x27;m a big fan of Rust myself, there are a few points that lack rigour in this article (which are typical of &quot;I love X&quot; articles). Three points that struck me:<p>- rust-analyzer is good (as in: it&#x27;s functional, it&#x27;s advancing, etc.etc.), but it&#x27;s alpha; it&#x27;s not a tool that can be considered a mature tool of a mature language. I often encounter issues while working on projects.<p>- learning Rust is a serious problem IMHO, not only because it&#x27;s hard in itself, but it&#x27;s because it&#x27;s hard to structure a plan to learn it. listing the reference book is indeed a misrepresentation: a complete beginner that reads the whole book will still have significant problems in working on a real project; it&#x27;s very unclear which step to take after reading it, as real-world Rust programming needs exercise which is not tackled by any book. Things are made worse by a number of garbage books (Packt being very guilty of this) that pretend to teach programming in Rust by slapping a 20-pages chapter on the syntax and basic concepts.<p>- &quot;for the vast majority of code I author, Rust feels more like Python than C&quot;: feelings are subjective, so I can&#x27;t argue in an absolute sense, but the complexity of programming is very, very far from Python. In scripting languages like Python&#x2F;Ruby one doesn&#x27;t need to care about anything: memory allocation (which in itself, has many consequences, including on the program structure), data types, syntactic rigour, exact consistency of the program (in the sense: one can develop a half broken Python app, and it will stull run); all of these things are required in a statically typed language. Golang is probably a language that is closer to Python than C.
评论 #26795771 未加载
colesantiago大约 4 年前
TL;DR?<p>That looks like a very long essay &#x2F; dissertation just to say &#x27;I love rust&#x27;.
评论 #26794224 未加载
评论 #26794666 未加载
评论 #26794158 未加载
评论 #26794205 未加载
mnd999大约 4 年前
I skimmed it, but I think what the author is getting at is that rust demands rigour. The kind of rigour required when failure is a problem and this tends to be the kind of code people get paid to write.<p>I guess the reverse is also true, if you’re writing the kind of code where failure doesn’t matter (e.g. spikes, experimentation, just messing about) perhaps rust isn’t the best choice.
评论 #26794626 未加载
评论 #26794539 未加载
评论 #26794726 未加载
noisy_boy大约 4 年前
&gt; You see practices cargo culted across the decades (like the 80 character terminal&#x2F;line width and null-terminated strings, which can both be traced back to Hollerith punchcards from the late 19th century)<p>I limit my lines to 80 chars for more practical reasons. I have a wide-screen 43&quot; monitor and restricting content to 80 columns allows me to have the project&#x2F;navigation pane + 4 vertical splits side by side. Couple of those vertical splits can be split horizontally and I can see&#x2F;edit, say, 6 open files at once without any switching of windows. Probably sounds like overkill but once you experience it, you know its worth it. Plus my eyes like less horizontal scanning too.
评论 #26795659 未加载
hderms大约 4 年前
Anyone who has a bunch of rust experience: does writing things like mutable tries, or other data structures with complex ownership semantics ever become truly natural? I find rust really straightforward to write when the ownership is straightforward, but I find myself out of my depth in a lot of cases.
snake_case大约 4 年前
A few years back I chose Rust as the language I was going to build side projects with. I started out building a wasm A* pathfinding demo [1] to get a better hang of it.<p>A little bit later I wrote a CLI task runner [2] which is defined by a simple markdown file. I find Rust to be perfectly aligned with the goals of a CLI utility: single deployable binary and very low startup cost.<p>Most recently I launched a side project [3] (a jigsaw puzzle website) using Rust as my backend API service. I&#x27;ve been slowly building up a server framework over the years and finally was able to put it to use! Yes, it took me much longer to ship something in Rust versus other languages I&#x27;m more familiar with. But after learning Rust for a few years now, it doesn&#x27;t take me much more time to build a feature than it would in another language.<p>Early on, I ran into a lot of borrower issues and got stuck many times. But after I got over those problems, I realized that for any future hurdles I would face, I just needed to keep pushing and eventually I would find a solution. I have found that with game development or heavily stateful apps, I tend to run into borrower issues more often. But for an API service with a simple input and output, I almost never run into borrower issues.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;jakedeichert&#x2F;wasm-astar" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jakedeichert&#x2F;wasm-astar</a><p>[2]: <a href="https:&#x2F;&#x2F;github.com&#x2F;jakedeichert&#x2F;mask" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jakedeichert&#x2F;mask</a><p>[3]: <a href="https:&#x2F;&#x2F;puzzlepanda.com" rel="nofollow">https:&#x2F;&#x2F;puzzlepanda.com</a>
f154hfds大约 4 年前
I have to concur with the author on Rust. I remember when I read the book a few years ago I had just spent several years doing professional development in C++ and Python, and had recently discovered the GIL much to my dismay. After reading the Book I felt like I stepped through some proverbial door and could never go back. The features by themselves aren&#x27;t really that remarkable but all of them together in one package - every time I use Python or C++ now I want Rust syntax, tooling, etc.<p>Now, my biggest critique - because of Rust&#x27;s emphasis on static dispatch and monomorphization (good decisions all around if you ask me), plus the fact that lifetimes provide their own type dimension - I find that open source projects can have absolutely monstrous types, impossible to reason about. It&#x27;s tough because I prefer the WYSIWYG templating Rust offers over C++ duck typing any day but many of these crates&#x27; types are too complex. In fairness, most of the most egregious cases were due to the lack of const generics and those cases are quickly improving.<p>As an example, I&#x27;ve been playing around with websockets recently and ran into this type: <a href="https:&#x2F;&#x2F;docs.rs&#x2F;websocket&#x2F;0.26.2&#x2F;websocket&#x2F;server&#x2F;upgrade&#x2F;struct.WsUpgrade.html" rel="nofollow">https:&#x2F;&#x2F;docs.rs&#x2F;websocket&#x2F;0.26.2&#x2F;websocket&#x2F;server&#x2F;upgrade&#x2F;st...</a><p>Note 4 different impls, each with its own generic requirements! I&#x27;m sure each case makes sense somehow, but it sure complicates my life when I want to use a function and find it isn&#x27;t implemented for _my_ WsUpgrade.
lmilcin大约 4 年前
&gt; The statement Rust is for Professionals does not imply any logical variant thereof. e.g. I am not implying Rust is not for non-professionals. Rather, the subject&#x2F;thesis merely defines the audience I want to speak to: people who spend a lot of time authoring, maintaining, and supporting software and are invested in its longer-term outcomes.<p>I think the title is a little bit misleading and paired with the first sentence invites flame, but this one in the middle of article sums it up much better.<p>With some languages you pay some special costs that are only recovered for certain types of applications.<p>For example, programming in C is slow, tedious and bug-prone (as compared to Python) but it is easier to solve some types of problems (like writing system software, controlling memory layout for performance, conserve resources, etc.) For most projects the cost may be too high but if you are one of certain types of projects the pros will outweigh the cons.<p>In general, when programming with strong types you pay for long term maintainability (ability to automatically ascertain correct type of object at any point and extra features that come from it).<p>In Rust you pay even more for even more benefit in controlling the types and ownership of the data which means this environment should be thought as geared even more towards long term maintainability.
valand大约 4 年前
Even learning Rust on the surface already change a lot on how you perceive errors, type-based error, thread-safety, expression-oriented code and lifetime.<p>I write typescript for work. I have adapted some concepts such as the encoding invariants into type (using a proven library such as fp-ts and io-ts) and using return over throw for error handling has been yielding better and scalable code.<p>Not to mention Rust&#x27;s types for managing concurrency and shared objects, like Rc, Arc, Mutex, that drive the architecture of your software. I have been doing a similar thing in my projects in other language and the impact has been very positive<p>Edit: typo
pantulis大约 4 年前
&quot;(...) Rust feels more like Python than C. (...)&quot;<p>This feels like a very powerful assertion. Does the rest of the HN audience agree with this? If this is true, how long did it take?
评论 #26794842 未加载
评论 #26794739 未加载
评论 #26795967 未加载
zabzonk大约 4 年前
Could equally well say &quot;C++ is for professionals&quot;, or &quot;Java is for professionals&quot; and so on ad nauseam, with pretty much the same specious justifications.
ocschwar大约 4 年前
The title implied that it&#x27;s not for amateurs, and now that I have some data about Rust and teenagers, I can say it very much IS for teenagers. After one afternoon wrestling with GDB and C code, they&#x27;re ready to put up wrestling with the borrow checker.
评论 #26794451 未加载
Koshkin大约 4 年前
Depends on the meaning of the word &#x27;professionals.&#x27; Most of those who earn their living by coding (which is whom I would call professionals), use JavaScript, C++, Java, or C# - and, I&#x27;m afraid, will continue to do so for many years to come.
osigurdson大约 4 年前
Rust is for the true Scotsman.
评论 #26801255 未加载
geodel大约 4 年前
The way I see is Rust for people who love to write about writing code quite a bit more than writing code itself.
mastrsushi大约 4 年前
Rust sounds like a pretty promising language. Considering in the future everything will run in garbage collected VMs written in C++ anyway ;)
评论 #26794936 未加载
StreamBright大约 4 年前
&gt; To me, Rust introduced a number of new concepts, like match for control flow, enums as algebraic types,<p>He must be joking.
评论 #26794326 未加载
评论 #26794111 未加载
评论 #26794072 未加载
评论 #26794070 未加载
评论 #26794026 未加载
评论 #26794078 未加载