Live data from Hacker News

Rewrite Everything in Rust

robert.ocallahan.org

231–240 of 242 posts

Re: Rewrite Everything in Rust

#231
post #87

Just gonna throw this out there: what if instead of working on creating the myriad of "better languages" we focus on actual mastery of simpler languages like C. And with that mastery: what about writing some machine-learning software that detects vulnerabilities as part of the build/release cycle. For instance: http://news.mit.edu/2016/faster-automatic-bug-repair-code-er... To detect vulnerabilities people need to be…

>Just gonna throw this out there: what if instead of working on creating the myriad of "better languages" we focus on actual mastery of simpler languages like C. Relying on people being careful does not work for security, where one exploit is as good as many. OTOH, simpler languages can work well for performance, features and almost everywhere else; where even if you don't have specific language features to guard aga…

Hence why I followed up with:

"what about writing some machine-learning software that detects vulnerabilities as part of the build/release cycle"

Re: Rewrite Everything in Rust

#232

Just gonna throw this out there: what if instead of working on creating the myriad of "better languages" we focus on actual mastery of simpler languages like C. And with that mastery: what about writing some machine-learning software that detects vulnerabilities as part of the build/release cycle. For instance: http://news.mit.edu/2016/faster-automatic-bug-repair-code-er... To detect vulnerabilities people need to be…

we focus on actual mastery of simpler languages like C We've had 44 years for people to master the "simplicity" of C. Turns out, writing C is simple but writing safe, reliable C borders on the impossible even for the most masterful masters who ever mastered their mastery of the language. Better return on investment would be to work on killing C with something that doesn't have C's problems.

"but writing safe, reliable C borders on the impossible" I wouldn't go that far.. Just get a set of best practices and follow them. Write unit tests for every function. One of the best things about C is its extremely unit-testable.

I followed up with the vulnerability-detection software to address any difficulties in security bugs. That would provide the benefits of C with a line of defense to correct vulnerabilities.

"what about writing some machine-learning software that detects vulnerabilities as part of the build/release cycle"

Re: Rewrite Everything in Rust

#233
post #229

Just gonna throw this out there: what if instead of working on creating the myriad of "better languages" we focus on actual mastery of simpler languages like C. And with that mastery: what about writing some machine-learning software that detects vulnerabilities as part of the build/release cycle. For instance: http://news.mit.edu/2016/faster-automatic-bug-repair-code-er... To detect vulnerabilities people need to be…

Mastering C over using Rust is like mastering abacus, over using computer.

Funny :)

Re: Rewrite Everything in Rust

#234
post #230
post #228

Earlier quoted context omitted.

The syntax is killing these languages. Sure it's superficial, but programmers are human beings and I doubt most people find it appealing to voluntary stare at and type PROCEDURE BEGIN END and other LONGCAPITALIZEDWORDS...

Most programmer friendly editors for those languages supported formatting as you type, gofmt isn't the first of its kind. Also it makes very easy to recognize reserved keywords.

BEGIN COMMENT No matter what editor does, programmer still has to look at this ugliness. :D END

Re: Rewrite Everything in Rust

#235
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…

Firstly, I want to say I agree with you that these types of projects require more respect and financial incentives. That said, I think its worth noting: Rust fundamentally democratizes systems programming. Rewriting in Rust, increases the contributor pool for these project from some x to some y. Where x is the subset of people in [1, 2, 3, 4, 5] and y is the subset of people in [1, 4]: 1. Who are eager and have time…

> [Made redundant by the compiler.]

The compiler doesn't obviate the need to understand memory management. Anyone who doesn't understand ownership and borrowing will have really hard time getting rustc to accept their code in the first place.

What Rust's type checker does is make up for the human inability to be perfectly careful. Even the most diligent programmer will make mistakes or forget something. (This is a fact of life. It can't be fixed with present-day technology.) Relative to C and C++, Rust enlarges the class of “stupid mistakes” that can be detected automatically, and this is always a good thing, no matter how knowledgeable and careful programmers are.

Re: Rewrite Everything in Rust

#236

Earlier quoted context omitted.

Firstly, I want to say I agree with you that these types of projects require more respect and financial incentives. That said, I think its worth noting: Rust fundamentally democratizes systems programming. Rewriting in Rust, increases the contributor pool for these project from some x to some y. Where x is the subset of people in [1, 2, 3, 4, 5] and y is the subset of people in [1, 4]: 1. Who are eager and have time…

> [Made redundant by the compiler.] The compiler doesn't obviate the need to understand memory management. Anyone who doesn't understand ownership and borrowing will have really hard time getting rustc to accept their code in the first place. What Rust's type checker does is make up for the human inability to be perfectly careful. Even the most diligent programmer will make mistakes or forget something. (This is a fa…

We've actually had feedback from some startups using Rust for low level stuff (where their teams comprise mostly of Python/Ruby/JS devs) that Rust teaches systems programming and memory management quite well (since you're forced to work with it), unlike C++.

Re: Rewrite Everything in Rust

#237

Earlier quoted context omitted.

> [Made redundant by the compiler.] The compiler doesn't obviate the need to understand memory management. Anyone who doesn't understand ownership and borrowing will have really hard time getting rustc to accept their code in the first place. What Rust's type checker does is make up for the human inability to be perfectly careful. Even the most diligent programmer will make mistakes or forget something. (This is a fa…

We've actually had feedback from some startups using Rust for low level stuff (where their teams comprise mostly of Python/Ruby/JS devs) that Rust teaches systems programming and memory management quite well (since you're forced to work with it), unlike C++.

> Rust teaches systems programming and memory management quite well

Couldn't agree more. Incidentally, this is also what I dislike so much about C: it does a very poor job of telling the programmer what is wrong with their program. Learning systems programming with C feels (to me, at least) like learning to walk by crawling in the dark.

Re: Rewrite Everything in Rust

#238
post #234
post #230

Earlier quoted context omitted.

Most programmer friendly editors for those languages supported formatting as you type, gofmt isn't the first of its kind. Also it makes very easy to recognize reserved keywords.

BEGIN COMMENT No matter what editor does, programmer still has to look at this ugliness. :D END

Beauty is in the eyes of the beholder. :)

Re: Rewrite Everything in Rust

#239
post #226

Earlier quoted context omitted.

> Systems programming does not preclude a language from having a good type system or higher level abstractions. I didn't say that system programming does not need a good type system. I am also not saying that it is impossible to design operating system software with Rust. As someone who had been on both the sides of the abstraction and having closely interacted with the system programmers, I think it is just too hard…

> does not need a good type system Yeah, I'm just saying that "higher kinded types" (which, again, Rust isn't getting anytime soon), does not make Rust something that isn't targeting systems programming; in response to "you folks are really targeting C/System programmers". Many of Rust's designers are experienced systems programmers. A _lot_ of effort goes into making it systems-ready. > it is about what minimum you…

> Many of Rust's designers are experienced systems programmers. A _lot_ of effort goes into making it systems-ready.

That is promising. Thanks. I am certainly playing with it at home.

Re: Rewrite Everything in Rust

#240
post #190

Earlier quoted context omitted.

Another gripe I have is that the Rust Book examples are all targeted at non-system programmers. It would have been nice if certain programs written in K&R book or from one of those books from the Bell Labs Unix folks (like "The practice of programming" or "software tools") is written in Rust as a demonstration.

You should be much happier with the second edition of the book. (One of the reasons it's this way is largely historic: so much was changing in the lead-up to 1.0 that I couldn't add many examples, as things kept changing out from under me.)

Thanks. Where can I see the second edition draft?

edit: This one? https://github.com/rust-lang/book.git

Post reply on HN