Hacker News new | ask | show | jobs
by zxcdw 4892 days ago
If all people started writing code in a modern C++ equivalent called Rust this would be a better world. After all in comparison Rust is safe by nature unlike C or C++. :)
5 comments

Really? I should switch my apps from C++ to an unfinished language?

I'll consider once the Mozilla foundation have written any application of note in it.

You should not switch your apps. You should stop creating new projects in C++ once Rust is mature enough for your liking.

The fundamental "problem" we're having/facing with C and C++ is the investments we've put in. Lots of "infrastructure" in modern day computing relies on C and C++ and will do so for ages. We can't just drop the projects and switch to something else(say Rust or maybe Go), but we can stop creating new C and C++ codebases to alleviate the problem for the future.

No, we can't, because Go is unacceptable (garbage collection) and Rust is no better than a figment until all of the libraries I need exist in it.

And I have better things to do than port them, because C++ doesn't bother me.

Exactly, it's a chicken and egg problem. C++ has tons of libraries, while Rust has barely any. Rust can use external C bindings, but not C++ ones yet. I think if they solve the issue of using C++ libraries from within Rust, the transition will be much easier, and meanwhile more native Rust libraries will be created.
Is the C++ ABI issue ever going to be solved?
Yes, in the cases where the operating system is done in C++.

The C ABI is the operating system ABI and it is only ubiquitous in operating systems done in C. Other operating systems use whatever ABI the system offers.

That's part of the problem they are facing. C is much easier to deal with.
My new projects rely on C++ libs, so I can't use Rust.
How many Rust libraries are there for various tasks? What IDE supports Rust? What tutorials, books and conferences exist that teach and distribute the state of the art in development techniques? What example projects have been build in it to demonstrate its feasibility for large projects? What tools support Rust (continuous integration, code formatting/checking, build tools, ...)?
I'm sure make and git work with Rust like anything else.
Well using make as an example of anything good is... let's say 'suspicious'. There is more to tooling than make and git (note that I deliberately omitted version control from my list)
While switching now isn't feasible, keep in mind the sunk cost fallacy.
Has any interesting large program been written in Rust besides the Rust compiler itself?
Not really. The closest is Servo,[1][2] the massively-concurrent browser engine that the language was designed to create. But it's not very featureful yet, and is only a few thousand lines (compared to 100+ kloc for the Rust compiler itself).

[1] https://github.com/mozilla/servo

[2] https://github.com/mozilla/servo/wiki/Design

I'm also looking foward to Rust, but it's not "here" yet :P
It's too early yet to make claims like that. Rust may or may not end up supplanting C++ in some areas, but even in the most optimistic case it definitely won't obviate C++ entirely.
I've been working my way through the Rust tutorial. As much as I like the power and control it gives me, they really need to take a note from Go on the syntax. Some of the even fairly contrived examples are an eye-sore. I need to give it more time but yeesh there's a lot of syntax to look out for.
Can you give some specific examples? I myself have been known to bikeshed with the Rust devs on occasion. :P
Not exactly related to syntax, but one of the issues I've found with following the tutorials is that there is only a handful working programs which actually show the feature in question in use. While I understand that (as the tutorial explicitly mentions) the tutorial is very terse and quick glance at the language features, I feel it could be improved tremendously if there was even one a few line fully compilable program exploring the features per section.

Then again I also understand that because the language changes and evolves, maintaining more code in the docs means more effort. However, this is one of the few things I've felt bugging me as an end-user. Of course I believe this can be expected to change for the better in the future as the language matures and stabilizes, but I figured I'd voice this out given this perfect opportunity. :)

That's a good idea, but it's going to require a bit of thought to implement. It might make sense to have an "advanced examples" external page for every section in the tutorial, which would sort of transform the current tutorial into an annotated table of contents. Which could be really neat! But perhaps it should wait until Rust has some analogue to play.golang.org available.