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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Why Rust?

233 点作者 emilern超过 2 年前

26 条评论

azangru超过 2 年前
&gt; By using Rust for both our frontend and backend, we have a unified stack of Rust everywhere, simplifying our hiring.<p>&gt; I can write web apps in another language than JavaScript<p>&gt; I can write web apps that are fast<p>Yeah, this is what&#x27;s worrying me. If you look at rerun.io website, you will notice that it&#x27;s built with Next.js, i.e. is using a React framework to build pages that have no interactivity whatsoever. Next.js is used for the blog, despite it being just a collection of simple static html pages. Meanwhile, the user has to download around 200kB of javascript for no reason whatsoever; and the only reward that they get for their trouble is an avalanche of javascript errors in the browser console [0].<p>Is the Rust&#x2F;wasm future going to look like that?<p>[0] - <a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;TpYW0Rj.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;TpYW0Rj.png</a>
评论 #33246651 未加载
评论 #33246523 未加载
评论 #33247013 未加载
评论 #33249431 未加载
评论 #33250496 未加载
cageface超过 2 年前
I&#x27;ve started working in Rust too and I too find it a tremendous breath of fresh air. It&#x27;s the first time I&#x27;ve been excited about a new programming language in many years.<p>C++ promised to be a language that was both high performance and very expressive but I always found it very difficult to work at a high level of abstraction in C++. The sharp details always stab through.<p>Rust code, on the other hand, often doesn&#x27;t look much more elaborate than code I write in much higher level languages but it&#x27;s far, far faster and I feel more confident in its correctness.<p>Too bad most of the Rust jobs right now seem to be in crypto.
评论 #33246821 未加载
评论 #33245917 未加载
评论 #33248326 未加载
评论 #33247076 未加载
评论 #33245765 未加载
评论 #33246839 未加载
评论 #33245736 未加载
评论 #33245855 未加载
pdpi超过 2 年前
&gt; Rust&#x27;s enums and exhaustive match statement are just amazing<p>ADTs + pattern matching are the killer feature set that makes the more popular functional languages so damn pleasant to use, and they&#x27;re starting to spread to more and more languages. I suspect that, 50 years from now, we&#x27;ll look back and see them as the key paradigm shift of this era.
评论 #33246356 未加载
评论 #33246617 未加载
评论 #33245732 未加载
评论 #33246010 未加载
评论 #33245885 未加载
评论 #33245639 未加载
评论 #33248211 未加载
评论 #33246595 未加载
评论 #33245742 未加载
richdodd超过 2 年前
&gt; There is of course some legitimate worry that the Rust crate ecosystem could devolve into the crazy left-pad world of npm, and it is something to be wary about, but so far the Rust crates keep an overall high quality.<p>Note that the particular case of left-pad cannot happen with crates.io&#x2F;cargo, because once published, you cannot unpublish a crate. You can &#x27;yank&#x27; it, in which case it will not be resolved by Cargo.toml, but if you put it in Cargo.lock directly (IIUC) it will still work. So we can&#x27;t have someone pulling a crate and crashing half the ecosystem.<p>We can however still have lots of other problems that plague all package management systems. Check out `cargo-crev`!!!! It&#x27;s an awesome idea I&#x27;m always plugging to solve the lack of trust in an open library repository. It requires people to participate though.
评论 #33246719 未加载
评论 #33246373 未加载
losvedir超过 2 年前
&gt; Rust&#x27;s enums and exhaustive match statement are just amazing, and now that I&#x27;m using them daily I can barely imagine how I could live without them for so long.<p>I feel this! I absolutely love rust&#x27;s fancy enums - i.e. not just a set of constants, but where each variant can be a full fledged type of its own, and how you have to handle every case whenever you&#x27;re matching on it. It dovetails absolutely wonderfully with non-nullability and errors as values. This is probably the main nice-to-have in a language for me. Unfortunately, I don&#x27;t really work in a low-level domain so I&#x27;m not sure the extra complexity of manually managing memory is worth it to me.<p>Do any other higher-level languages have rust-style enums with exhaustiveness checking? I only know of Haskell and Ocaml. Actually, I suppose TypeScript has something kind of similar.
评论 #33245570 未加载
评论 #33245664 未加载
评论 #33250589 未加载
评论 #33247319 未加载
评论 #33245566 未加载
hsn915超过 2 年前
&gt; Safety and speed<p>One thing I can&#x27;t seem to find a quick answer to from the Rust crowed is how does Rust handle dynamic lifetimes? It seems like it does not; it simply prevents you from referring to objects that have a dynamic lifetime not known at compile time.<p>You either have to use &#x27;unsafe&#x27; or use the &#x27;handles&#x27; pattern where you have what amounts to a custom allocator but the compiler does not know that it&#x27;s an allocator so it can&#x27;t prevent &#x27;use after free&#x27; bugs.<p>I suppose you can also use Rc, but isn&#x27;t that essentially a garbage collection scheme, with similar performance characteristics? (AFAICT a reference counting scheme must be able to nullify all references to an object when it&#x27;s deallocated, so deallocations can become arbitrarily expensive).<p>Am I missing something?
评论 #33245797 未加载
评论 #33245487 未加载
评论 #33246065 未加载
评论 #33245412 未加载
erk__超过 2 年前
&gt; Floating point behavior<p>Since 1.62 there have been a native way of doing it with the `total_cmp` method [0] on floating points which can be used to at least sort it quite easily, but cannot really use it in collections like BTreeMap.<p>[0]: <a href="https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;std&#x2F;primitive.f64.html#method.total_cmp" rel="nofollow">https:&#x2F;&#x2F;doc.rust-lang.org&#x2F;std&#x2F;primitive.f64.html#method.tota...</a>
评论 #33246004 未加载
bobajeff超过 2 年前
As someone who&#x27;s not the biggest fan of Rust because of its complexity. There is a big reason to use it today. If you need to use something that has safety guarantees where it&#x27;s possible to achieve acceptable performance in certain classes of programs where languages like golang, nim or crystal have trouble achieving then I just don&#x27;t see any other options out there certainly not one with as many libraries available as rust.<p>Maybe I can use a combination like c and lua to get the right trade offs between safety and performance in the necessary parts of my program but I&#x27;m not that confident that I can reach either safety or acceptable performance doing that.<p>Maybe, I could use C and some kind of static analyzer to find all of my memory bugs. Again, I&#x27;m not confident I would succeed there. I might also need a fuzzer to do it. At this point I&#x27;m trading a complicated language for a easy fast language with extra complicated operations that may or may not give me the outcome of memory safety.
评论 #33247372 未加载
评论 #33250623 未加载
评论 #33248260 未加载
评论 #33246758 未加载
cyber1超过 2 年前
Most benefits of Rust are true, except in some cases it does not allow you to compile an absolutely valid and safe program like here <a href="https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;issues&#x2F;47680" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;issues&#x2F;47680</a> - unfortunately you don&#x27;t have freedom of code design decisions! I see some possible problems with refactoring, extending logic and functionality, and lots of issues with async code design and readability.<p>For me, Rust looks like a temporary step before the next language.
评论 #33253575 未加载
dgan超过 2 年前
I don&#x27;t understand why everyone seems to ignore Ada? Granted I am completely new to it, but from what I see it is years ahead of Rust in terms of safety (it can <i>prove</i> correctness!! Rust is only heading into that direction).<p>Yes syntax is verbose, but I dare to believe there must be another blocker than just syntax?
评论 #33247203 未加载
评论 #33247911 未加载
评论 #33262492 未加载
amelius超过 2 年前
This must be how people felt about C++ in the beginning ...
评论 #33251329 未加载
评论 #33247871 未加载
评论 #33246525 未加载
评论 #33247304 未加载
djha-skin超过 2 年前
&gt; We&#x27;ve had fast languages like C and C++, and then we&#x27;ve had safe languages like Lisp, Java, and Python. The safe languages were all slower.<p>Them&#x27;s fightin&#x27; words. SBCL (Lisp) totally screams with speed as far as I&#x27;ve been able to tell.
评论 #33248852 未加载
clemens3超过 2 年前
I just bootstrapped Rustc 1.58 using only GCC and mrustc sources on an 8 core 16 thread machine with 32 GB memory and lot&#x27;s of disk space. It took 20 hours.<p>If you think Rust is bloated, I agree.
评论 #33252555 未加载
commitpizza超过 2 年前
As a developer who mainly writes front end apps with Javascript (but with experience in a lot of other languages), I started to learn Rust for an app I want to build.<p>The issue is that the app itself will not really be needing maximum performance and I much more concerned about the safety aspects Rust brings. But I guess the safety aspects would be the same with me using Python for example.<p>Why I want to learn Rust is because it could help me in the front end aspect and I think it&#x27;s a language that has a bright future.<p>Am I crazy to spend the time to get effecient in Rust and write my app I want to write in Rust instead of Python? Is there any other benefits of using Rust that I don&#x27;t see as a beginner? I am afraid that I&#x27;ll just waste a bunch of time just because I want to learn Rust and think it&#x27;s cool but ultimately it will slow me down to such an extent that my app never sees the light of day or that it increases general development time.<p>Thanks in advance for all potential responses
jmartrican超过 2 年前
I saw a YT video about how safe Rust is. I want to give it a try but I do mainly web applications, where I use Spring Boot and front-end frameworks. From what I have read Rust is better for system level or regular applications (not web apps). Can modern web applications be built efficiently with Rust? And by efficiently I mean, is the ecosystem there (libraries and tools).<p>I imagine the following would be needed..<p>1) Spring MVC like library for interfacing with HTTP requests.<p>2) DB ORM or ORM like. DB libraries for any possible DB.<p>3) centralized logging. e,g, Logback that forwards all logs to ELK.<p>4) Dependency injection.<p>5) Versatile configuration system. Similar to Spring configurations.<p>6) AWS SDK.<p>7) Commons like libs like Guice or Apache Commons.<p>stuff like that.
评论 #33247707 未加载
评论 #33253687 未加载
评论 #33250725 未加载
auraham超过 2 年前
I&#x27;ve heard about Web Assembly&#x2F;Wasm many times. I thought it was a new kind of JS framework, so I did not pay attention since I am not a JS developer. However, after seeing the egui.rs demo [1], I was impressed! Now, I am interested in knowing more about programming languages that compiles to Wasm. Is it possible to create that sort of UI using other programming languages?<p>[1] <a href="https:&#x2F;&#x2F;www.egui.rs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.egui.rs&#x2F;</a>
cageface超过 2 年前
For someone like me that&#x27;s an experienced programmer but relatively new to Rust, what are some open source Rust projects that could benefit from some help?
评论 #33252497 未加载
评论 #33248453 未加载
trinovantes超过 2 年前
I wish C++ has a universal dependency manager like crates. It feels like every external library I want to use requires their own exotic setup.
评论 #33250756 未加载
jmull超过 2 年前
Honestly, this kind of breathless adulation is off-putting to me.<p>&gt; If I&#x27;m honest, the main reason is because I love Rust.<p>That&#x27;s nice if it works for you, but I&#x27;m looking to build and maintain software well and efficiently. I don&#x27;t want a programming language I can love I want a tool. (BTW, old and tired but true: don&#x27;t love things that can&#x27;t love you back.)
评论 #33246424 未加载
labrador超过 2 年前
In &quot;Oral History of Bjarne Stroustrup&quot; Bjarne describes his goal for C++, which was abstractions with zero runtime cost : <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZO0PXYMVGSU" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZO0PXYMVGSU</a><p>I understand Rust is fast, but how does it do with complex abstractions?
quuuu超过 2 年前
One issue with egui and shoving the whole page into a canvas element is accessibility -- having just a canvas element is a screen reader&#x27;s worst nightmare
评论 #33255122 未加载
listenlight超过 2 年前
Does Rust have a webapp framework like Rails?
评论 #33245821 未加载
bovermyer超过 2 年前
How does Rust do at random number generation? Is there (for example) a crate for seeding random number generators?
评论 #33247806 未加载
bjarneh超过 2 年前
&gt; A lot of people who are new to Rust struggle with the borrow checker<p>Guilty as charged
WesolyKubeczek超过 2 年前
TL;DR — because the author loves it, followed by what can be described as multiple paragraphs of personal preferences.
评论 #33245463 未加载
评论 #33245426 未加载
stefanka超过 2 年前
Thanks for the article? You are not still hiring per chance..?
评论 #33247459 未加载
评论 #33246731 未加载