Live data from Hacker News

Rewrite Everything in Rust

robert.ocallahan.org

181–190 of 242 posts

Re: Rewrite Everything in Rust

#181
post #6

Earlier quoted context omitted.

Thanks for doing this... I think the way to tackle a rust glibc rewrite: Step 0 - write a code generator that just generates rust code that call the C versions of glibc symbols ( based off of the publicly exposed API in the library files). Get test suite to run Step 1 - Make that rust code generate a 100% drop-in replacement fro the C symbols (maybe this requires injecting version numbers) Step 2 - write the `getaddr…

For step 0, look at Rust's libc crate. For step 1, you'd need to carefully look at glibc's ABI, which is even more complicated than its API due to backward compatibility and symbol versioning.

Yeah ABI compatibility might be problematic, my currently plan is to LD_PRELOAD what I have to test it for speed. I have the feeling that rust could mock the ABI and serve as a general replacement, but first things first is it even fast enough to use at the lowest levels of the system.

Re: Rewrite Everything in Rust

#182
post #167
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…

> I also wish that Rust authors stop adding more and more > features. I'm not sure what this is referring to. Rust hasn't added any features since the stable 1.0 release last May, and I also don't believe it added any features in the six-month beta period prior to that. And it's not an especially feature-heavy language in the first place, likely comparable in size to Python (e.g. a medium-sized language).

I was referring to the RFCs. They also seem to include language changes. Happy to be proved wrong.

Re: Rewrite Everything in Rust

#183

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…

We have done a lot of things to prioritize adoption, though we could do better.

We have done some almost-studies like this: we had a series of conference calls with companies using production Rust specifically to work on their pain points, for example.

Re: Rewrite Everything in Rust

#184
post #182
post #167

Earlier quoted context omitted.

> I also wish that Rust authors stop adding more and more > features. I'm not sure what this is referring to. Rust hasn't added any features since the stable 1.0 release last May, and I also don't believe it added any features in the six-month beta period prior to that. And it's not an especially feature-heavy language in the first place, likely comparable in size to Python (e.g. a medium-sized language).

I was referring to the RFCs. They also seem to include language changes. Happy to be proved wrong.

We have and will add language features; though we haven't added any HUGE things in a while. You are right that RFCs contain language changes. A lot of them are small. Some of them are big, and there's certainly more big ones on the horizon.

Re: Rewrite Everything in Rust

#185
post #108

Earlier quoted context omitted.

Problems that Rust can't now address are listed in that RFC. Such as sharing of fields between definitions for instance. Traits don't address that. See also these posts: * http://smallcultfollowing.com/babysteps/blog/2015/05/05/wher... * http://smallcultfollowing.com/babysteps/blog/2015/05/29/clas... * http://smallcultfollowing.com/babysteps/blog/2015/08/20/virt... * http://smallcultfollowing.com/babysteps/blog/2015/…

Note that while many OOP patterns are hard to express in Rust, there are equivalent patterns that handle the use cases. To give some context on those blog posts; they exist to figure out how to add single inheritance to Rust. One of the strongest arguments for single inheritance in Rust is "Servo and similar things need it to model the DOM". I.e; the strongest argument out there is that modelling cross-language thing…

> while many OOP patterns are hard to express in Rust, there are equivalent patterns that handle the use cases.

May be there are, but they far from trivial, and with the current level of documentation they are in the realm of some obscure hacks rather than straightforward part of the language. Which is a disadvantage. May be when The Book will cover OOP topics in depth and explain such patterns, or there will be some other dedicated documentation on this topic, things could become more clear.

Re: Rewrite Everything in Rust

#186
post #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.

As of just now, we've had 1323 contributors to the main repository, not counting Cargo, some crates, or the website, for example.

Mozilla is paying virtually all of the people who are working on it full-time, but there are a lot of people doing a lot of work in their spare time too.

  > with the way things have been going the past few years
If you're referring to the projects which have been dropped over the past few years, I can see that. At the same time, Firefox is the core product, and Rust is already in Firefox, so dropping it doesn't seem likely. The amount will only be increasing.

Re: Rewrite Everything in Rust

#187

Earlier quoted context omitted.

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.

You can use a custom allocator on nightly.

Re: Rewrite Everything in Rust

#188

IMO -- Better is to just write better tools for plain olde ANSI-C. We can build tools to check C as well as any other. Let's just not waste time on building further complexity into our toolset and look at building toolkits and best practice at the very flexible level of abstraction that Plain olde C provides. With the right tools and expertise, we can improve the world without the never ending whiz bang rewrite.

  > We can build tools to check C as well as any other.
This is simply not true; language semantics determine the kinds of tooling you can build. Ruby is so dynamic that it's notoriously hard to build tools for, for example.

Re: Rewrite Everything in Rust

#189
post #182

Earlier quoted context omitted.

I was referring to the RFCs. They also seem to include language changes. Happy to be proved wrong.

We have and will add language features; though we haven't added any HUGE things in a while. You are right that RFCs contain language changes. A lot of them are small. Some of them are big, and there's certainly more big ones on the horizon.

May I ask what those big ones are? How is it going to affect/improve the life of a systems programmer?

Re: Rewrite Everything in Rust

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

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.
Post reply on HN