Live data from Hacker News

Rewrite Everything in Rust

robert.ocallahan.org

131–140 of 242 posts

Re: Rewrite Everything in Rust

#131
post #9

I think this misses the real problem. So many pieces of foundational software like glibc and OpenSSL are understaffed, underfunded, and plagued by terrible code. Go read glibc getaddrinfo: it's a mess! Rewriting the software in Rust would not solve these problems any more than rewriting it in C++ would. A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that…

There isn't one "real" problem. You are talking about one problem, and rust solves another. I don't see any reason your comment needs to be framed as a contradiction to the OP.

Re: Rewrite Everything in Rust

#132

Rust has major unsafeness around low memory that make it unsuitable in this libc type role. See: https://www.reddit.com/r/rust/comments/2mthq2/how_would_a_ru... and https://lwn.net/Articles/644708/ Due to this issue that the rust authors seem unwilling to address, I fully recommend against rust for the precise roles it's intended to be good at.

From second link:

> Obviously on OOM you usually want to abort _something_. It's just not always the entire thread or process.

Surely you want to abort _some dynamic extent_. The fact that it's (currently) a full C thread is an implementation detail that can hopefully be improved. Requiring manual OOM handling on every single operation is not a scalable solution and will lead to bugs due to laziness or fatigue.

Exceptions aren't necessarily bad/evil. A lot has been learned about the challenges of exceptions/conditions/effects. Language designs will evolve to have better versions of what is a foundational idea in the theory of computation.

In the meantime, a try/catch block is only a small macro over thread::spawn, thread::join, thread::catch_panic away. It would be nice if the language supported that without the weight of a full thread.

Re: Rewrite Everything in Rust

#133

Do user studies. It's pretty much unheard of, but nearly every open source project would benefit far more from a week of watching potential contributors trying to get up to speed than it would from making sure the project roadmap is delivered a week sooner. That's my claim for projects in general, and what you're asking for re Rust is a little different, but the approach can applied there, too. Focus on everything fr…

This is the most insightful comment in the discussion. It should have been obvious, but it wasn't until you posted it.

First, design a sound language that solves problems other languages don't (done). Then, optimize for adoption ... because the world only benefits from that new language once adoption really takes off.

Rust has done half the job really well. And a decent start on the second half -- mainly because the first half was done so well.

But if the Rust team were to prioritze adoption the way the parent post espouses, they'd be changing their priorities significantly, and it's probably the most effective way to make sure Rust fulfills its potential.

Re: Rewrite Everything in Rust

#134
post #9

I think this misses the real problem. So many pieces of foundational software like glibc and OpenSSL are understaffed, underfunded, and plagued by terrible code. Go read glibc getaddrinfo: it's a mess! Rewriting the software in Rust would not solve these problems any more than rewriting it in C++ would. A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that…

Maybe do both? Rewriting in Rust and increasing incentives.

Writing security critical software in c++/c is not the sensible thing to do in my opinion (even though it is the standard right now). Humans in general cannot handle it without making a lot critical errors. And the people working on those projects are already really smart in general. This has been shown again and again.

If c++ was a car, it would force you to place your foot in a special position in between breaking and accelerating. If you do it wrong, your foot will get squashed in the exposed drive train.

Of course for the point of the argument I am exaggerating, but I really applaud the efforts Rust has made in order to advance the security of software.

Re: Rewrite Everything in Rust

#135

If a given piece of software has been largely written using certain patterns or conventions, then it is often possible for a syntactic rewrite engine to be able to match those patterns, then output idiomatic code patterns in the target language. This may well be applicable to kernels and other constituents of an OS.

Have you even looked at the source code to glibc? It's stuffed full of macros and #ifdef hell. Not to mention symbol versioning, the use of gcc-specific compiler extensions, and ancient-UNIX-beard performance hacks. You'd have more success teaching a chimpanzee to play the violin, than automatically translating glibc into anything.

So I guess we need more than just a "transliteration" to a safer language. We really need to shed that cruft and write something clear and understandable.

Could we also drop a lot of requirements that applied to older, more limited hardware? (Or, do certain constrained hardware situations still require most of those requirements to stick around?)

Re: Rewrite Everything in Rust

#136

Earlier quoted context omitted.

This is why I personally think the OSS community should be more encouraging of "salary" style funding. There is a loud, poisonous minority of advocates that seem to think that asking for money is just plain evil. That attitude is a material disservice to OSS in general: it makes OSS weaker and less capable, for the sake of some weird puritan reflex. N.B.: I have never and will never ask for, nor accept any income fro…

There seems to still be too many people who cling to the romantic notion that Free Software must be produced for free, as a pure labour of love. It's absolute nonsense - so many of the most successful free/open source software projects are those with salaried employees working on it, and this has been the case for many years. The problem today is of course finding a way to fund open source contributors whose projects…

[deleted]

Re: Rewrite Everything in Rust

#137
post #95

Earlier quoted context omitted.

I feel like C++ has turned into programming language Katamari Damacy. I wonder what it will look like when it rolls up Lisp?

This is one of the psychological barriers that keeps me from even trying to learn C++ - every time I hear friends talking about new C++ developments I can't help but feel that modern C++ is so incomprehensibly large that I'm just left paralysed.

Modern C++ is not that huge, it just has lots and lots of weird corner cases and gotchas due to backwards compatibility. You can get reasonably proficient in a couple of weeks, just like any other programming language. You'll just be left with the nagging feeling that you don't understand _everything_ that might happen in your code.

Is it exception safe? Are my iterators always valid? Is this undefined behaviour?

So better keep a copy of the C++ standard open and keep reading whenever you feel unsure.

Re: Rewrite Everything in Rust

#138
post #9

I think this misses the real problem. So many pieces of foundational software like glibc and OpenSSL are understaffed, underfunded, and plagued by terrible code. Go read glibc getaddrinfo: it's a mess! Rewriting the software in Rust would not solve these problems any more than rewriting it in C++ would. A rewrite would clean up the code, sure, but then you're left in the same situation, only with brand new bugs that…

This is why I personally think the OSS community should be more encouraging of "salary" style funding. There is a loud, poisonous minority of advocates that seem to think that asking for money is just plain evil. That attitude is a material disservice to OSS in general: it makes OSS weaker and less capable, for the sake of some weird puritan reflex. N.B.: I have never and will never ask for, nor accept any income fro…

> This is why I personally think the OSS community should be more encouraging of "salary" style funding.

How about something like https://gratipay.com/

Re: Rewrite Everything in Rust

#139
post #127
post #102

Earlier quoted context omitted.

I'll be thrilled when Herb finally releases his lifetime enforcement tool, but until then it's too soon to celebrate. The mystery surrounding the details of Herb's approach still raises unanswered questions regarding the soundness and practicality of such a tool. It's also evident that Herb didn't bother trying to learn from Rust in the slightest back when devising this tool, see his own remarks on Reddit: https://ww…

It is available to VS 2015 Update 1 users.

I don't believe it is, unless something's changed. To quote MSDN:

"The package currently contains checkers for the Bounds and Type profiles. Tooling for the Lifetime profile demonstrated in Herb Sutter’s plenary talk (video at https://www.youtube.com/watch?v=hEx5DNLWGgA) will be made available in a future release of the code analysis tools."

https://blogs.msdn.microsoft.com/vcblog/2015/12/03/c-core-gu...

Re: Rewrite Everything in Rust

#140
post #89

Earlier quoted context omitted.

How would we decide what specific projects are actually worked on?

How does the NIH decide what research gets funded?

* Shudders * In recent years the shifts reduction of public funding levels combined with a cultural shift toward emulating business models and proving ROI has, IMHO, stilted creativity, exploration, and the creation of basic fundamental science. An analogous situation would be tons of grant money spent on Rails-like frameworks (because it's 'hot') while fundamental projects like "rewriting a safe glibc" would be deemed lacking in utility.
Post reply on HN