Live data from Hacker News

Rewrite Everything in Rust

robert.ocallahan.org

171–180 of 242 posts

Re: Rewrite Everything in Rust

#171
post #155
post #152

Earlier quoted context omitted.

I don't have access to a Windows machine right this moment to check, but a cursory search of the internet gives no indication that this tool has been released in any subsequent update. If it had, you'd think there'd be some fanfare, or acknowledgement, or documentation, or experience reports from users, or anything.

Have you seen the CppCon presentation? About 1% of the audience answered affirmatively to Herb's question about who was using some kind of static analysis tools. Outside HN and Reddit circles, very few C and C++ developers, at least the typical enterprise ones, don't really care about such tools. Back on my C++ days, just one company cared to pay for Insure++ and I was probably the only one using it. This is way I am…

I won't dispute that the vast majority of C++ developers seem to be indifferent to static analysis (look how many decades it took John Carmack to come around...), but the initial video presentation did cause a noticeable stir, and I would expect the actual release of the tool to incite a comparable reaction.

Re: Rewrite Everything in Rust

#172
post #171
post #155

Earlier quoted context omitted.

Have you seen the CppCon presentation? About 1% of the audience answered affirmatively to Herb's question about who was using some kind of static analysis tools. Outside HN and Reddit circles, very few C and C++ developers, at least the typical enterprise ones, don't really care about such tools. Back on my C++ days, just one company cared to pay for Insure++ and I was probably the only one using it. This is way I am…

I won't dispute that the vast majority of C++ developers seem to be indifferent to static analysis (look how many decades it took John Carmack to come around...), but the initial video presentation did cause a noticeable stir, and I would expect the actual release of the tool to incite a comparable reaction.

Yes I do agree with you.

Nowadays I only use C++ for hobby coding between Android and WP nowadays, or when I need to step out of JVM/.NET worlds, so I missed to follow up on it.

Re: Rewrite Everything in Rust

#173
post #2

I have actually started to do this to see for myself how much work it would be http://blog.dkhenry.com/2016/02/17/deciding-to-rewrite-getad...

The mere existence of getaddrinfo is a symptom of the disease. Just look at it. It lacks a clear interface. It's designed for calling code which is like, "Gee, I don't know exactly what I've got. Maybe it's a local IPv6 address, maybe it's a remote hostname. But I might want to bind it. Or maybe connect to it. I'll get back a list of these things which might be useful. Most likely I'll choose the first one or maybe write an ad-hoc filter to pick the one I actually want." Systems programming doesn't have to be this crappy.

I get it, the idea is to replace this core low-level library with something you could maybe run C programs on top of. But damn, that is a crappy interface (which is specified by both an ISO standard and an IETF RFC so I must be an idiot, right?).

Re: Rewrite Everything in Rust

#174
post #122

Rust is nice. But the article miss one important point. Modern software engineering is a collaborative effort (well, it has always been, afaik). I write code for others to understand. I find Rust code significantly hard to read (I am saying this as an experienced C/C++ programmer and as an intermediate haskeller). Yes, one can write write-only code in any language. I think it is extremely important to write code that…

It's also missing the important point that rewrites don't happen just by talking about them and making grandiose statements.

I counted about two people in the entire thread that have actually written code to support this much desired rewrite. The rest are chitchatting.

Re: Rewrite Everything in Rust

#175
post #7

How practical is rust for small processor IoT applications? Like the ESP8266 we saw recently? https://news.ycombinator.com/item?id=11148129 They often have horrible security, but are very small programs when you use them as wifi temperature sensors or similar. They are good targets for rewrites and greenfield applications. Right now it seems like ardunio C++ or some scripting language is the target.

There's a port of ATS programming language for the ESP8266. There's some slides on it here:

http://www.slideshare.net/master_q/safer-iot-using-functiona...

ATS is a functional programming language that does not use a garbage collector and uses dependent and linear types to do safe system programming. It provides a similar level of safety to Rust with the ability to drop down to C: http://www.ats-lang.org/

Re: Rewrite Everything in Rust

#176

Earlier quoted context omitted.

I don't understand the difference between #1 and #2, or why Rust helps with one and not the other. If memory safety is enforced, it's enforced. > Rust helps with #2 but let's not kid ourselves, what percentage of a library like glibc would be spent in unsafe blocks? string.h is not as interesting as, say, the DNS resolver. Nothing about the DNS resolver needs to be unsafe.

It's true. In my DNS code I have zero unsafe code. Though I did need to add some new unsafe code to the Rust OpenSSL library, but that's really because of the FFI to C. That too would be unnecessary if OpenSSL was rewritten in Rust.

Does the OpenSSL library allow/plan for an Rust reimplementation (possibly side-by-side for a while) of the C bits? Seems that would be best practice - assuming the goal is make everything safe Rust.

Re: Rewrite Everything in Rust

#177
post #143
post #123

Earlier quoted context omitted.

And as a Rust and Python programmer, I find C++ hard to read (I can never shake the feeling that the ampersands are always in the wrong place), and I'm nearly hopeless at deciphering Haskell. :P I suppose this is just something that comes with experience.

Haskell syntax is really nowhere near as complex as C++'s or even Rust's. It's not indecipherable, it's just different and not C-like. It's in the same family as SML, OCaml and F# so if you learn one of those, the others come easily.

I suspect Haskell's syntax isn't as much of an issue as the typical style that Haskell code tends to be written in; really short, abbreviated variable names, and very high code density.

Re: Rewrite Everything in Rust

#178
post #19

Is there a "glibrust" or equivalent standard library for Rust, yet?

Rust of course has a standard library[0] and it includes a libc, but (I might be wrong here) I think the libc portion is FFI into glibc or similar. I think the stuff written in rust is considerably more high-level, focusing more on data structures, concurrency, string manipulation, etc. [0]: https://doc.rust-lang.org/std/

I guess what I'm asking is if the syscall wrappers are in rust or if rust just calls glibc wrappers.

Re: Rewrite Everything in Rust

#179

"[Other safe languages] require complex runtime support that doesn't fit in certain contexts (e.g. kernels)." Complex runtimes are also unsuitable for libraries. If you write a great openssl replacement in Haskell, it's only useful for Haskell applications. Because nobody wants to link the Haskell runtime into many of the applications that use openssl. For widespread libraries, the choices are basically C, C++, and n…

You can provide C bindings for you Rust library.

Which is "for widespread libraries, the choices are basically C, C++, and now (hopefully) rust.": as in C++ you can use high-level constructs internally without relying on an extensive runtime, and expose and easy-to-FFI C interface.

Rust still has insufficiencies though, the inability to customise the (library's) allocator is one I think.

Re: Rewrite Everything in Rust

#180
How dependent is Rust on Mozilla for support now? Has it developed its own community of contributors? I like Mozilla and their mission, but with the way things have been going the past few years I wouldn't want to put a lot of time into porting my projects to something whose future was dependent on Mozilla.
Post reply on HN