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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Bjarne Stroustrup Weighs in on Distributed Systems, Type Safety and Rust

151 点作者 rsecora将近 5 年前

14 条评论

distsysdude将近 5 年前
&gt; He’s aware of other languages, as he reveals in his answer to a later question. (“I think C++ can do anything Rust can do, and I would like it to be much simpler to use.”) And towards the end, he couldn’t resist noting that longevity has its advantages. “It’s highly humorous when some of the Rust people come up and accuse me of having stolen some of their ideas without acknowledging — when some of the things I did I actually did almost 40 years ago.”<p>Does anyone know what these accusations were? Given that C++ has been around for so long, It&#x27;s incredulous to think that anyone from the Rust community can put forth such a claim.
评论 #24037114 未加载
评论 #24037140 未加载
评论 #24040445 未加载
评论 #24037319 未加载
评论 #24038215 未加载
评论 #24037498 未加载
评论 #24037726 未加载
评论 #24039988 未加载
评论 #24037574 未加载
评论 #24038937 未加载
diego_moita将近 5 年前
&gt; Once you get users, you have responsibilities, and one of the responsibilities is not to break their code.<p>That is both a good and bad thing.<p>Within both C++ and JavaScript there is a very elegant programming language with powerful semantics.<p>However, there are also a lot of bad solutions and dangerous hacks accumulated. And most of us programmers don&#x27;t know how or don&#x27;t have the self discipline to separate the good parts from the bad parts. And sometimes even with the knowledge and self discipline you can&#x27;t avoid them (e.g: when using someone else&#x27;s libraries).<p>In some languages (e.g: Lua, Python) the designers are ready to break backwards compatibility. C++ chose not too.
评论 #24038844 未加载
评论 #24039690 未加载
评论 #24037712 未加载
评论 #24039068 未加载
评论 #24037752 未加载
评论 #24039263 未加载
cletus将近 5 年前
In Rust, ownership is a compile-time issue. This puts constraints on how you can use references, how ownership is passed around and so on. This programming model has a cost to the user and is probably inherently slower to compile just because the compiler has to do more.<p>But at runtime it&#x27;s essentially free.<p>C++ on the other hand added a set of primitives starting in C++11 to be explicit about ownership through std::unique_ptr and such. These have a runtime cost and ultimately mean getting locks. I&#x27;ve seen estimates of this cost in the single digit microseconds. Not exactly super-expensive but not free either.<p>There are simply some assumptions Rust can make that C++ can&#x27;t because certain things aren&#x27;t possible in Rust.<p>Another example: Rust doesn&#x27;t have exceptions. Over the years I personally have some to believe that exceptions are largely a false economy (particularly the failed experiment that is&#x2F;was checked exceptions in Java).<p>Instead Rust has match expressions and enumerated types (with state!) that force you to deal with return types. This BTW is very much what Google C++ looks like. It&#x27;s even debated if you can ever write truly exception-safe C++ code.<p>This is another problem Rust doesn&#x27;t have by virtue of not having the feature.<p>Are you starting to see the pattern? C++ has everything in it. That comes at a cost and there&#x27;s no getting around that.
评论 #24042392 未加载
评论 #24046789 未加载
sprite将近 5 年前
A bit off topic but I didn’t want to make a separate post for this. I want to brush back up on C++ and learn all the modern features. It’s been over 10 years since I’ve touched any C++ and looking for a good book recommendation for someone that’s familiar with many other programming languages and has programmed quite a bit of c&#x2F;c++ in the past.
评论 #24038774 未加载
评论 #24037746 未加载
评论 #24038239 未加载
评论 #24037755 未加载
评论 #24037711 未加载
评论 #24037723 未加载
hu3将近 5 年前
&gt; We have a model for better concurrency coming up. Almost certainly it will be in [C++ version] 23. It exists and it’s used. It’s backed by people like Facebook and NVIDIA and Intel… So that’s where we’ll get a better concurrency, better use of hardware… Beyond that, I am looking at functional-style pattern matching...<p>Better concurrency and functional-style pattern matching? Yes please.
评论 #24037451 未加载
an_d_rew将近 5 年前
Also, don&#x27;t forget that C++ has _age_ behind it. Lots of places are still on arm-gcc-5 because heaven forbid you try to get a new compiler digesting an old code base, then get all stakeholders and customers onboard.<p>I dream of C++20. But my nightmares are all pre-C++14.
评论 #24047519 未加载
评论 #24040965 未加载
pojntfx将近 5 年前
Does the case for C++ in 2020 still exist? Rust and Go are much simpler to learn, can do everything that C++ can and have sane, simple and clean build systems&#x2F;package managers, not to mention async&#x2F;await concurrency in the former and channels in the latter.
评论 #24037210 未加载
评论 #24038984 未加载
评论 #24037593 未加载
评论 #24037397 未加载
评论 #24040021 未加载
评论 #24037431 未加载
评论 #24037606 未加载
评论 #24037301 未加载
评论 #24037424 未加载
评论 #24037094 未加载
评论 #24037240 未加载
评论 #24037930 未加载
评论 #24037089 未加载
评论 #24037414 未加载
评论 #24037164 未加载
评论 #24037421 未加载
评论 #24037573 未加载
评论 #24037738 未加载
评论 #24039630 未加载
atombender将近 5 年前
Does anyone have an example of a large codebase that actually uses modern C++ to its fullest?<p>One of the larges codebases I know about, Chromium, seems to use only a minimum of C++ features. It&#x27;s mostly limited to 1980s &quot;C with objects&quot; paradigm, plus smart pointers.
评论 #24048828 未加载
评论 #24044702 未加载
luord将近 5 年前
“I don’t believe that there is or could be a perfect programming language — at least not in the time scale we’re talking about, a few decades or a hundred years. Maybe in a hundred years, but not in my lifetime.”<p>Absolutely agree and wish more people did.
lajawfe将近 5 年前
He talks about fixing Exceptions in c++, what is wrong with exceptions in c++ and how would you fix those? Go does not have exceptions, but I don&#x27;t think Go&#x27;s method of checking for error on every step and doing early returns is more elegant.
ryeguy_24将近 5 年前
&gt; &quot;Users spend most of their time on other sites. This means that users prefer your site to work the same way as all the other sites they already know.&quot;<p>While likely accurate, this thinking is likely not conducive to UX innovation.
评论 #24040337 未加载
arcticbull将近 5 年前
&gt; “I think C++ can do anything Rust can do, and I would like it to be much simpler to use.”<p>I think Bjarne isn&#x27;t getting the <i>issue</i> with C++. Yes they&#x27;re Turing-complete, yes they can both solve the same set of problems.<p>The issue is that C++ can do <i>everything</i> that <i>every</i> other language can do, which means it&#x27;s not a language, it&#x27;s a universe of features. You make the language by picking which features, patterns, philosophies, architectures you want. It&#x27;s like if a language dictionary included English, simplified Chinese and Korean.<p>The problem IMO is there&#x27;s no such thing as C++. Each company, each team, each person has their own. Many of these C++&#x27;s are incompatible with each other.<p>Worse, many of the new language features can&#x27;t be properly implemented because they would break someone else&#x27;s C++.<p>The problem is it tries to be everything to everyone, and that makes it (and futures standardization efforts) full-on Quixotic efforts. I mean, by all means, have at those windmills tho.<p>Bjarne points out how much he hates templates, and has some great new ideas for generic programming. Lovely, but he&#x27;s never gonna get rid of templates, so now we have 2 problems.
评论 #24040335 未加载
评论 #24040571 未加载
评论 #24041406 未加载
评论 #24040380 未加载
评论 #24041006 未加载
评论 #24041252 未加载
评论 #24042447 未加载
评论 #24040749 未加载
评论 #24040426 未加载
评论 #24040249 未加载
tybit将近 5 年前
I’d love to know how he’d like for C++ to support distributed systems in broad strokes.<p>The first thing that comes to mind is things like gRPC or the actor model but I can’t imagine he has either of those in mind.
评论 #24037435 未加载
yahyaheee将近 5 年前
&gt; I think C++ can do anything Rust can do, and I would like it to be much simpler to use<p>You&#x27;re going to need to break c++ then. It is so much harder to use than Rust today, I have no idea why anyone would choose c++. The libraries argument is mute because its such a pain to use external libraries.