Live data from Hacker News

Why I think Rust is the "language of the future" for systems programming

winningraceconditions.blogspot.com

71–80 of 193 posts

Re: Why I think Rust is the "language of the future" for systems programming

#71

I'm a die-hard C guy. My motto for years has been "you can pry pointers and address spaces from my cold, dead hands." Of the new languages I've seen lately, Rust is my favorite. I love how it gives me better ways to express things I actually want to say without imposing GC on me. But even so, I can't see myself actually using it for much, because writing in a language other than C means buying in to that language's r…

I'm not sure if this will alleviate all of your issues, but eventually the goal is to allow Rust programs to forgo the runtime entirely.

An old comment from pcwalton (sorry, I've lost the link):

"I'd like to see a 'runtime-less Rust' myself, because it'd be great if we could implement the Rust runtime in Rust. This might be useful for other things too, such as drivers or libraries to be embedded into other software. (The latter is obviously of interest to us at Mozilla.) Rust programs compiled in this mode would disable the task system, would be vulnerable to stack overflow (although we might be able to mitigate that with guard pages), and would require extra work to avoid leaks, but would be able to run without a runtime.

"If anyone is interested in this project, I'd be happy to talk more about it -- we have a ton of stuff on our plate at the moment, so we aren't working on it right now, but I'd be thrilled if anyone was interested and could help."

See also the remark by brson further down in this thread: http://news.ycombinator.com/item?id=4578044

Re: Why I think Rust is the "language of the future" for systems programming

#72

I'm a die-hard C guy. My motto for years has been "you can pry pointers and address spaces from my cold, dead hands." Of the new languages I've seen lately, Rust is my favorite. I love how it gives me better ways to express things I actually want to say without imposing GC on me. But even so, I can't see myself actually using it for much, because writing in a language other than C means buying in to that language's r…

"If write a library in Rust, how can I expose my types and algorithms to Ruby, Python, Lua, etc?"

The same way you expose them in C. Rust and C are compatible at the binary level.

"How will Rust Tasks play with Python threads?"

More or less the same way C setcontext()/swapcontext() workalikes play with Python threads. We probably want a runtime-less Rust to allow users who aren't using tasks at all to just omit the whole system, though. The language itself knows nothing about tasks; they're purely part of the runtime library.

"What if I use a Rust Pipe to send a Python value between tasks?"

Should work as you expect. In Servo we're already sending Objective-C values (which require special APIs to perform the memory management) from task to task over pipes.

"How do I keep Rust from doing a GC pass while I'm holding the Python GIL?"

By not using the GC. It's easy to tell when you aren't using the GC; you can just avoid @ types, and there is a warning you can turn on to enforce no GC use. This sort of thing is the reason why we support manual memory management.

"If you're only writing an application (ie. not a library) and never want to embed other languages into your application, then this might be ok. But I'm more interested in writing shared functionality that is useful across languages."

We're already successfully embedding a JavaScript engine into a pure Rust program for Servo. JavaScript can access Rust types and vice versa.

"Why should the whole stack of parsers, crypto, compression, etc. have to be written separately in each language?"

I agree completely that this is undesirable. That's why Rust doesn't do this. For your three examples, Rust and Servo link to C libraries: Hubbub for HTML parsing, NSS for crypto, and zlib for compression.

Re: Why I think Rust is the "language of the future" for systems programming

#73
post #17

Rust is what I had hoped Go would be. Google employs some of the brightest computer science minds in the world and turns out stuff like Go and Dart, which seem to be more aimed at enterprise Java programmers rather than computer scientists or programming enthusiasts.

Neither Mozilla nor Google are particularly keen to faff around designing languages for the hell of it. :) Google needed to ease the burden of hours-long Java/C++ compile times on massive projects. Hence Go. Mozilla needed a language that was as fast as C++, but safer and trivially parallelizable. Hence Rust. Beyond these goals, the fact that the rest of the world is excited for these languages is just gravy.

You know, I've worked on some pretty large C++ projects, and the only time I've seen an hour long compile time, it was due to some include hell that was pretty trivially optimized.

Re: Why I think Rust is the "language of the future" for systems programming

#74
post #70
post #17

Earlier quoted context omitted.

Neither Mozilla nor Google are particularly keen to faff around designing languages for the hell of it. :) Google needed to ease the burden of hours-long Java/C++ compile times on massive projects. Hence Go. Mozilla needed a language that was as fast as C++, but safer and trivially parallelizable. Hence Rust. Beyond these goals, the fact that the rest of the world is excited for these languages is just gravy.

I understand C++ project can take a long time to compile. Does Java project really take hours to compile?

If any project takes hours to compile, it needs to seriously be refactored.

Re: Why I think Rust is the "language of the future" for systems programming

#75
post #52
post #45

Earlier quoted context omitted.

I wondered how long it would take for somebody to call me out for that. It seemed like a sketchy claim when I wrote it (it wouldn't be too complicated to make the @-heap lock-free in rust, for starters), but in retrospect, I shouldn't have said it at all. Thanks for pointing that out.

I tried to think of an alternate justification, but couldn't come up with a non-awkward way of saying it, so just redacted that part entirely. I'll say here, though, a few reasons I think avoiding malloc/GC is important: - pcwalton has mentioned his desire to be able to reason about when the garbage collector runs, so that he can statically guarantee that the graphics rendering task in servo will never take a big pau…

That comment about GC in graphics sounds like BS to me.

Java manages to handle situations like graphics rendering & GC perfectly well. You simply choose a GC that doesn't take large pauses. Graphics isn't an environment where you prove or statically guarantee performance a priori ('statically guarantee') - you run, profile and modify till it works.

What's more, certain GCr's can make guarantees about not taking large pauses.

p.s.: this is no criticism of Rust - looks very interesting and as a C/C++ programmer, I'll definitely be taking a look at it.

Re: Why I think Rust is the "language of the future" for systems programming

#76
post #70
post #17

Earlier quoted context omitted.

Neither Mozilla nor Google are particularly keen to faff around designing languages for the hell of it. :) Google needed to ease the burden of hours-long Java/C++ compile times on massive projects. Hence Go. Mozilla needed a language that was as fast as C++, but safer and trivially parallelizable. Hence Rust. Beyond these goals, the fact that the rest of the world is excited for these languages is just gravy.

I understand C++ project can take a long time to compile. Does Java project really take hours to compile?

Rob Pike, on justifying the development of Go:

"today's server programs comprise tens of millions of lines of code, are worked on by hundreds or even thousands of programmers, and are updated literally every day. To make matters worse, build times, even on large compilation clusters, have stretched to many minutes, even hours."

http://splashcon.org/2012/program/404

Re: Why I think Rust is the "language of the future" for systems programming

#77
post #25

I don't know if it is the language of the future, but Rust is definitely high on my "let's reprogram Singularity/Plan9/Friends"-and-actually-use-it list I'd certainly join and attempt to help any project started in that direction, at least.

It's interesting that you mention Singularity, as it turns out that Singularity has been a major influence on Rust. For example, the current communication is very similar to the channel contracts used in Singularity.

Re: Why I think Rust is the "language of the future" for systems programming

#78

I'm a die-hard C guy. My motto for years has been "you can pry pointers and address spaces from my cold, dead hands." Of the new languages I've seen lately, Rust is my favorite. I love how it gives me better ways to express things I actually want to say without imposing GC on me. But even so, I can't see myself actually using it for much, because writing in a language other than C means buying in to that language's r…

"If write a library in Rust, how can I expose my types and algorithms to Ruby, Python, Lua, etc?" The same way you expose them in C. Rust and C are compatible at the binary level. "How will Rust Tasks play with Python threads?" More or less the same way C setcontext()/swapcontext() workalikes play with Python threads. We probably want a runtime-less Rust to allow users who aren't using tasks at all to just omit the w…

Thanks a lot for the info!

> We probably want a runtime-less Rust to allow users who aren't using tasks at all to just omit the whole system, though.

I'd be really interested in reading more about this if/when it is available. I'm also interested in whether you'd ever ship the tasks library standalone, such that you can interoperate with Rust tasks from C (obviously you'd have to follow certain rules to maintain the integrity/safety of the runtime).

> I agree completely that this is undesirable. That's why Rust doesn't do this. For your three examples, Rust and Servo link to C libraries: Hubbub for HTML parsing, NSS for crypto, and zlib for compression.

Understood, but I'm interested in the story for the guy who is writing those libraries.

Re: Why I think Rust is the "language of the future" for systems programming

#79

Earlier quoted context omitted.

"If write a library in Rust, how can I expose my types and algorithms to Ruby, Python, Lua, etc?" The same way you expose them in C. Rust and C are compatible at the binary level. "How will Rust Tasks play with Python threads?" More or less the same way C setcontext()/swapcontext() workalikes play with Python threads. We probably want a runtime-less Rust to allow users who aren't using tasks at all to just omit the w…

Thanks a lot for the info! > We probably want a runtime-less Rust to allow users who aren't using tasks at all to just omit the whole system, though. I'd be really interested in reading more about this if/when it is available. I'm also interested in whether you'd ever ship the tasks library standalone, such that you can interoperate with Rust tasks from C (obviously you'd have to follow certain rules to maintain the…

You'd want a runtime-less Rust if/when it becomes available (there are no immediate plans for this, but we'd be happy to help). We use native OS dynamic libraries, so once it's possible to build Rust code without a runtime it should be pretty easy to call Rust from a pure C host app.

Re: Why I think Rust is the "language of the future" for systems programming

#80
post #21

Earlier quoted context omitted.

Rust feels more like Perl 6 (always on the horizon) or Ada (the do everything language), while Go already is already specified, being improved, and out in production.

Oh, come on. Rust started as an open-source project in 2010 (with the release of the preliminary design and OCaml compiler that Graydon had written as a hobby project). At that time, work started on the self-hosting compiler, leading to its initial 0.1 release eight months ago, and proceeding with releases every few months and steady progress toward the remaining goals on the 1.0 roadmap [1]. Just because Go was deve…

I've attended a few Go meetups here in SF already, and I haven't even seen any Rust meetups on the radar.

At these Go meetups, companies are presenting what they're using Go for in production already, with great success. Go is not difficult to program in, Go is functional, Go is performant, Go is developer friendly.

That is not to say that Go doesn't have warts, it does (32-bit garbage collecting anyone? or the slow regular expression engine?), but people from Ruby, people from Python, and people from JavaScript are gravitating toward Go and _enjoying_ it.

Go also has excellent stewardship in the form of Pike et al.

In my mind, at least, the gap between Rust and Go is pretty big at this point. This is why Rust feels like vaporware (especially compared to Go).

People like to compare Go and Rust, and I think the comparison is pretty natural. The difference is that Go already has "boots on the ground."

If Rust releases something awesome in the next few months, the gap between Go and Rust could rapidly close (depending on developer adoption). But, in my mind, the longer Rust takes to iron out the quirks of it's syntax (not implementation, syntax!), the wider that gap will get.

Post reply on HN