Live data from Hacker News

Ask HN: Why do you use Rust, when D is available?

news.ycombinator.com

171–180 of 262 posts

Re: Ask HN: Why do you use Rust, when D is available?

#171
post #81

Earlier quoted context omitted.

I've been writing C++ professionally for 16 years. I'm doing it right now in fact, but snuck on to HN while a build is underway. OP is right, unfortunately. C++ is a dying language. Mozilla, Microsoft and Google are all looking at Rust. Why? Because it's probably makes more sense to rewrite a buggy C++ component in Rust instead of updating it to use modern C++ (where admittedly, you have to go out of your way to get…

C++ was a dying language in the 2000s. But they turned it around with C++11. Now it has iterative 3 yearly updates and it's getting pretty good. It's far too premature to declare its death. The pace of development of C++ is decently fast and there's many stakeholders with millions of lines of C++ who are interested in C++ not dying. C++ is taught in universities around the world so the chance of C++ developers becomi…

In fact, the number of C++ programmers is growing faster than ever. This is evident in the growing number and size of C++ conventions. (Bulgaria has its own, now.) Even ISO C++ Standard committee attendance is reliably a lot more than every previous meeting, even when held in inconvenient places. Attendance will hit 500 soon. The amount achieved at each meeting grows accordingly. Proposals get more scrutiny and draw on more experience.

To suggest C++ is a dying, slowing, or stagnant language is objectively delusional. The language is healthier than ever, and going gangbusters.

Re: Ask HN: Why do you use Rust, when D is available?

#172
post #152

Earlier quoted context omitted.

> It's only a game developer of all people, Jonathan Blow, that's doing it and his creation is a C++ replacement for games, not general purpose software. Sigh. That would still be huge. C++ keeps being used because of games. There's little to no C++ software being written nowadays that's not games. And games are a gigantic industry, bigger than the film and music industries combined. Many game developers would love t…

> There's little to no C++ software being written nowadays that's not games. You need to look around more, because you are totally wrong on this point. It's true that C++ isn't used a lot in web programming, and web programming is what a lot of people see these days. But there is a lot more software being written than web programming and games, and C++ is still in fairly significant use.

I do write a tiny bit of this not gaming C++. And I feel extremely alone in what I do.

So please, instead of being snarky, do something useful and show me some of this software!

Re: Ask HN: Why do you use Rust, when D is available?

#173
post #148

Earlier quoted context omitted.

The only language that one can honestly say that is dying (if not already dead) is VisualBasic. Perl and Delphi are probably going to continue to decline. Objective-C will be obsoleted by Swift some day, but is still relevant. Ruby's not too hot now, but far from dead AFAIK. Other than that it's nonsense to say that X is dying.

C++ is being blamed for allowing people to write buggy, insecure programs. In my mind, that's different to just becoming unpopular; it's dying because it's too dangerous and too complicated. Sure, it'll stick around for some years yet but all those jobs will become maintenance jobs. Very little greenfield projects will elect to use it outside of niche areas (games and maybe embedded - UK salaries for embedded dev are…

In fact, essentially all new development in the highest-paid financial, HPC, CAE, telecomm, aerospace, and ML fields is pure C++. Rust is not a blip in any of them, and will not be for years to come. C is dead there (except in aerospace and telecomm), Go is nonexistent, and Java is mentioned on rare occasions.

To suggest C++ usage is in decline is, objectively, nothing short of delusional. For Rust, C++ will the one to beat in ten and twenty years, provided not too many have already skipped onto some new hotness.

Rust is an objectively better design than anything else that has arisen in 30+ years. That doesn't guarantee success.

I used to hope a better language would displace C++, and for a time thought Rust might be it, but that better language turned out to be C++ itself. Nothing else is even on the horizon.

Re: Ask HN: Why do you use Rust, when D is available?

#174
post #99

Earlier quoted context omitted.

1. Could you give a few examples of libraries that can’t be made in Rust due to lack of abstraction compared to C++? I'm guessing, but I think that something like Armadillo[1] would not be possible on stable Rust. Something like Catch[2] might also difficult to make ergonomic. I don't program in C++ anymore and I would personally live with the lack of expression/abstraction for a safer language though. [1] http://arm…

Why are they impossible in Rust? Are you aware of Rust's macros right?

Rust macros know nothing about types, but types are what do all the work at compile time.

Re: Ask HN: Why do you use Rust, when D is available?

#175

The syntax is nicer. Granted, I'm not very familiar with D. I didn't even know it had a borrow checker. Rust took a lot of great features from Haskell, while keeping itself reasonably approachable from a C/C++/D/Java programmer's perspective. Rust put type names after variable/function/parameter names, which really cleans up the syntax nicely. Rust has very nice syntax for pattern matching, monads, and a slew of othe…

One of the reasons why I haven't approached Rust is its syntax. Subjectively ugly and polluted with punctuation symbols that tell you little about their semantics. D looks cleaner and more readable even for a person not familiar with the language. D's readability is on par with scripting languages. Rust is far away from that. Type names after variable or before? When you think about declaring a variable, do you think…

For reading code, which arguably should happen more often than writing code, having the variable name first makes it easier to find, since it's right near the beginning of the line and it's a single word. If the type comes first, I have to scan the line to figure out where the type ends and the variable name begins.

Also, having "let" at the beginning of the line makes it immediately clear that it's a variable definition, whereas if it starts with some arbitrary type I haven't seen before I have to spend more time figuring out what's happening. Good syntax highlighting helps, but I think starting with types like C/C++/D is less elegant than starting off with a keyword that clearly identifies what the line does.

Similar applies for function definitions. It's nice when the function names are all lined up and not buried halfway across the screen because it has some long return type.

Re: Ask HN: Why do you use Rust, when D is available?

#176
post #44
post #9

Engineers learn languages because of success stories by other companies—not by the merits of the syntax or one-off tricks like compiling itself in 5 seconds. The fact that Firefox uses Rust for the browser engine or that Dropbox uses Rust for the sync engine is the kind of thing that gets me interested.

Corporate sponsorship is the new prereq for a successful language/framework in today's world. It didn't used to be that way but it is now. Bring on our new googlemozillaapplefacebookmicrosoft language/framework overlords.

I dont think this is new. C and C++ came from Bell Labs, for example. Cobol from the USA government, FORTRAN from IBM. Java from sun, javascript from netscape.

In general, they all had a big institution. I presume these provided a a few ingredients, like

* A strong urge to solve a real-world problem

* A cradle, where smart people had time and resources to build a basic core

* A broadcast platform as others would look up to the institution, and notice what they were doing

From the top of my head, perl and python don't fit in this pattern, so its not universal, but I would dare to call it common.

Re: Ask HN: Why do you use Rust, when D is available?

#177
post #172

Earlier quoted context omitted.

> There's little to no C++ software being written nowadays that's not games. You need to look around more, because you are totally wrong on this point. It's true that C++ isn't used a lot in web programming, and web programming is what a lot of people see these days. But there is a lot more software being written than web programming and games, and C++ is still in fairly significant use.

I do write a tiny bit of this not gaming C++. And I feel extremely alone in what I do. So please, instead of being snarky, do something useful and show me some of this software!

Well, I work in embedded systems. They tend toward C++ on higher-end systems and C on lower end. So it's your wireless router, your printer, your car, your washing machine, the medical devices at your hospital... all over the place.

But embedded is maybe 10% of code. Where else is it used? I'm not as sure of that, but the TIOBE index indicates that it's used pretty heavily.

I'm outside of that world, but I think that high-performance computing sometimes uses C++, because controlling memory alignment is a big deal there, and C++ does that pretty well.

The origin story of Go says that Google has a lot of C++, but that was a decade ago. I can't speak to how much new C++ is being written there.

Perhaps one way of looking at it would be to look at the membership of the C++ standards committee, and subtracting the language vendors. The rest are users.

Re: Ask HN: Why do you use Rust, when D is available?

#178
post #9

Engineers learn languages because of success stories by other companies—not by the merits of the syntax or one-off tricks like compiling itself in 5 seconds. The fact that Firefox uses Rust for the browser engine or that Dropbox uses Rust for the sync engine is the kind of thing that gets me interested.

I think you have to be updated. Rust has had success in countless places after Firefox/Dropbox. With that being said fast compilation times are amazing and must be a default in new languages. If not they should follow an approach like Dart where there is a VM for development and also a AOT compilation support for producing binaries.

I didn't imply in the slightest those are the only success stories

Re: Ask HN: Why do you use Rust, when D is available?

#179
I tried D some years ago, my naive program crashed as it wasn't memory safe. Being used to scala this was a surprising to me, I expected "if it compiles it works" but it turns out I had to take lifetimes into account just like c/c++. Rust has this "if it compiles it works" + quality.

Then I needed to create a program that would work both on android and Windows. Still liking D's syntax better funding rust rather verbose I decided to give it another try, but failed, I had to jump through too many hoops to make it produce a library usable on android. While with rust the experience was effortless.

After both experiences with D, I never looked back to it and rust is now my go to low level system language, the verboseness (with lifetimes and types) has grown on me.

Re: Ask HN: Why do you use Rust, when D is available?

#180

Earlier quoted context omitted.

I’m currently trying to get into robotics. But why does everyone want c++? Surely robots can be programmed in other languages.

Rust is very very new compared to Cpp. People have decades of experience with cpp, learned in in University. Why would you throw all of that overboard just to learn a fancy new language with a weird ownership system? Keep in mind that people often still write cpp98 and have a rely hard time getting used to newer cpp concepts and programming styles. And all of that is backwards compatible with their existing codebase.

It will sound harsh, but people who can't up their game from C++98 to C++11, are probably not a people that I would consider hiring anyway. Generally, personally I would not hire anyone that knows just one programming language that they've learned in University and for years didn't manage to practice anything else, but that's just me.

I actually worked in Automotive, and the software higher level up the stack there is usually god damn awful piece of s*, often done by people who have almost no clue what they are doing, with plenty of misconceptions about how C/C++ even really works (using `volatile` for concurrency/atomicity and stuff like that). They are just beating their spaghetti code from segfault to segfault for decades.

This and slow delivery process easily explains why entertainment, navigation and other software-driven part of mainstream cars are so buggy, slow and generally terrible, and why Tesla could have so easily deliver way better experience.

So it doesn't matter that some people can't "get into Rust". The business that hire them will be replaced if they can't up their game, that's all.

Post reply on HN