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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Rust for Professionals

126 点作者 keewee7超过 2 年前

12 条评论

wrs超过 2 年前
An important “unblocker” for me when learning Rust after decades of other languages was internalizing that assignment is <i>destructive move</i> by default. Like many Rust intros, this sort of glides past that in the “ownership” section, but I felt like it should be a big red headline.<p>If you’re coming from C++ especially, where the move&#x2F;copy situation is ridiculously confusing (IMO), but also from a simpler “reference by default” language like Java, this has profound impact on what’s intuitive in the language.<p>For the C++ comparison, this is a pretty good article: <a href="https:&#x2F;&#x2F;radekvit.medium.com&#x2F;move-semantics-in-c-and-rust-the-case-for-destructive-moves-d816891c354b" rel="nofollow">https:&#x2F;&#x2F;radekvit.medium.com&#x2F;move-semantics-in-c-and-rust-the...</a>
评论 #34227278 未加载
评论 #34227181 未加载
attractivechaos超过 2 年前
Nice blog post. Nonetheless, to a new learner like me, the hardest part of rust is not its syntax; it is the ownership management. Sometimes I easily know how to implement a task efficiently in other languages but I have to fight the compiler in rust. I either need to reorganize data structures, which takes effort, or to make a compromise by cloning objects, which affects performance. Note that I do agree with rust designers that it is better to make data dependencies explicit but learning to deal with them properly is nontrivial for me.
评论 #34226429 未加载
评论 #34225157 未加载
评论 #34225167 未加载
xiphias2超过 2 年前
In my opinion this is the way _not_ to learn Rust. These syntaxes are not important at all, and doesn&#x27;t introduce lifetimes (which is by far the most important part of the language for deciding whether to use it or not).<p>Any blog about learning Rust for beginners should just contain information that helps the reader decide _whether_ she should put in the time required for learning it, then refer to the great Rust Programming Language book that&#x27;s really hard to surpass.<p>The reference is great as well, though personally I miss a part that formally defines the type system in its current form (there are some papers about lifetimes, but they are very hard to read).
评论 #34226441 未加载
mlindner超过 2 年前
It&#x27;d be nicer if there was some way of selection which language is shown on the left side. Expecting readers to understand both C++ and Kotlin and Java and Javascript will be a stretch for most.
评论 #34225050 未加载
评论 #34225509 未加载
评论 #34224746 未加载
评论 #34224806 未加载
评论 #34224796 未加载
deepsun超过 2 年前
&gt; Inner functions. Rust also supports inner functions. ...<p>&gt; Closures (lambdas). Rust supports closures (also called Lambdas, arrow functions or anonymous functions in other languages).<p>That&#x27;s misguiding.<p>Closures are not lambdas. Lambdas are just syntax, but the whole point about closures is that they capture the enclosing environment (have access to variables where it&#x27;s defined). Rust&#x27;s documentation states just that. Closures may or may not be lambdas.<p>In above example of &quot;Inner functions&quot; (which is also a closure) that would be more clearly explained if the inner function used an outside variable. Not all languages can do that.
joaquincabezas超过 2 年前
I keep saving these Rust resources for a near future... Am i the only one??<p>I really hope to start using Rust in 2023, probably for some kind of API gateway experimentation
评论 #34224755 未加载
评论 #34228731 未加载
评论 #34225778 未加载
solomatov超过 2 年前
This document only briefly mentions interior mutability, which IMO, is one of the most important things to become productive in Rust.
ridiculous_fish超过 2 年前
Curious why the author chose not to discuss macros? You encounter them immediately with a Hello World.
评论 #34226251 未加载
ww520超过 2 年前
This is an excellent short tutorial. It helps to compare and contrast to other languages.
jason2323超过 2 年前
As someone coming from a Java background, this seems useful! Thank you!
skor超过 2 年前
any constructive criticism on rust syntax?
评论 #34226170 未加载
评论 #34227746 未加载
评论 #34225277 未加载
评论 #34225818 未加载
tomr75超过 2 年前
the hardest part and barrier are the concepts behind lifetimes&#x2F;ownership&#x2F;borrowing not the syntax
评论 #34227453 未加载