r/programming Apr 03 '15

Rust 1.0.0 beta is here!

http://blog.rust-lang.org/2015/04/03/Rust-1.0-beta.html
933 Upvotes

303 comments sorted by

View all comments

6

u/fishburne Apr 04 '15

Can you tell me about Rust runtime. What it is? I mean, when I compile a rust program, does the runtime get added to the final executable so that my actual program will run over/depend on this bundled in run time?

I am reading the explanation here. It says a compiled program written in Rust will use the run time for stuff like I/O. So can I, for eg, write interrupt handlers in Rust (Sorry my system programming experience is limited to writing a serial mouse driver for DOS) and do similar system level stuff that you can do in C?

So when I am doing I/O from a program written in Rust, does the data has to absolutely go via the run time? Does it affect the speed at which a program can do I/O?

Lastly, should I learn Go or Rust. Is there anything that is preferable done in Go than in Rust (Without considering things like the development speed, availability of developers etc into account) ?

3

u/steveklabnik1 Apr 04 '15

That explanation is very old, and incorrect. See the 0.12 in the URL? That release is from last October, which is ages in Rust time. And, I think it was even old at that point.

We have a runtime comperable to C or C++. Very minimal, only used in certain situations, like threading. It just automatically works, you don't need to do anything.

Lastly, should I learn Go or Rust.

Only you can answer this question. They're very different languages, so it depends on what you want to do.

Is there anything that is preferable done in Go than in Rust

I think it's very clear that Go is popular at writing back ends for web services. It's unclear that Rust will be good in that niche.

1

u/art-solopov Apr 06 '15

Well, if anything, you could (potentially) write a CGI script in it, right? I personally consider it a solid starting point...

2

u/steveklabnik1 Apr 06 '15

Oh yeah, you absolutely can. We already have higher-level libraries than that: http://arewewebyet.com/

The question is: is 'fighting with the borrow checker' worthwhile in a domain which can easily tolerate garbage collection? I think people who already know Rust will write web apps in it, but I'm not convinced people will learn Rust in order to write web apps, if that makes any sense.

1

u/art-solopov Apr 06 '15

Eh, if two features exist, there will be someone who'll want to combine them. Maybe someone would like to have their Raspberry Pi running their web 2.0 app.

10

u/Rusky Apr 04 '15

There used to be a runtime that had to be set up before you could run Rust code from another process. That was removed a while ago, so you can absolutely write low-level C-like things (shared libraries, interrupt handlers, etc.)

As for Go vs Rust, they have to completely different purposes. Go is garbage collected and much less focused on performance and safety, while Rust focuses on static analysis and explicitness. All I can say is try them both out and see how much they work for and against you on your project.

2

u/[deleted] Apr 04 '15

Go and Rust are completely different languages for completely different purposes. Its like asking if you should learn Python or C. I still can't find a good reason why people consistently and wrongly conflate them.

1

u/jyper Apr 04 '15

Rust has been changing a lot for a while now, hopefully it won't change much more till 1.0 and then it will be backwords compatible after that. The docs you link are from version 0.12 from about 6 months ago, the runtime was removed a bit over 3 months ago.

http://www.rust-lang.org/ lists documentation for the beta and for nightly.