Live data from Hacker News

Using Rust for an Undergraduate OS Course

rust-class.org

41–50 of 72 posts

Re: Using Rust for an Undergraduate OS Course

#41
post #14

Can anyone elaborate on how "Rust changes the way you think"?

With Rust you need to be explicit about everything's lifetime. You cannot allocate some chunk of memory and freely borrow it; when borrowing you need a certificate (i.e. compiler check) that the borrowed reference has a shorter lifetime than that of the referenced memory. It is tremendously different from the absence of such guarantees (like C) or the GC-based weak guarantees (like Java and Go, which does not solve t…

c++ smart pointers under the hood? its actually cool.. to bake some of this directly in the language.. can prevent some memory copying by playing with raw pointers indirections under the hood in the lang runtime, etc..

But you already has to think like this when you use smart pointers in C++.. "who owns this reference?" etc..

But in C++ this is a library.. not a syntax.. point to rust for this

Re: Using Rust for an Undergraduate OS Course

#43
post #35

Is there any support for the article's assertion that C uses ‘=’ for assignment (and ‘==’ for equality) “to save memory”? dmr simply described it as “a matter of taste”¹ and hinted that he was simply used to typing ‘=’ for assignment². [Edit: And the compilers didn't keep source in memory, anyway.] ¹ http://cm.bell-labs.com/who/dmr/chist.html (also published in HOPL-II) ² History of Programming Languages II , Transcr…

Not to mention that Rust uses = and == the same way as C, although the expression "a = b" has unit type.

Re: Using Rust for an Undergraduate OS Course

#44
post #26
post #22

Earlier quoted context omitted.

Erlang's a weird choice for an OS class. An Erlang program is run in a VM that aggressively hides from you the exact things you want exposed in an OS class. As a user, that's great, as a way of teaching OSes, it's not so great. Plus the VM simulates a machine that is quite unlike today's real machines from an OS perspective.

Granted for an OS class they just seem to be writting a lot of web and network servers. Given their assignment list Go or Erlang would actually be a fit. I for example remember writing a kernel driver and learning about virtual memory and io schedulers. We wrote file servers in the "networking" class but hey, that was years ago and a different college, so maybe I am just old.

Implementing Erlang on bare metal would be a good idea for an OS class, writing code in it, not so much.

Re: Using Rust for an Undergraduate OS Course

#45
post #6

> Go. Go is a systems programming language Not those kinds of "systems". It is funny, it seems initially it was meant to be those kind of "systems", and then it pivoted as we like to say, to become a "distributed-server-network-backend systems" not "hardware-kernel-OS" kind of systems. And then creators kinds of winged it and remarked how "well, that's what we meant when we said systems". As for Rust, yeah, there are…

Other than the word "systems", was there any other indication that the Golang team meant to target OS kernels?

Re: Using Rust for an Undergraduate OS Course

#46

Earlier quoted context omitted.

With Rust you need to be explicit about everything's lifetime. You cannot allocate some chunk of memory and freely borrow it; when borrowing you need a certificate (i.e. compiler check) that the borrowed reference has a shorter lifetime than that of the referenced memory. It is tremendously different from the absence of such guarantees (like C) or the GC-based weak guarantees (like Java and Go, which does not solve t…

c++ smart pointers under the hood? its actually cool.. to bake some of this directly in the language.. can prevent some memory copying by playing with raw pointers indirections under the hood in the lang runtime, etc.. But you already has to think like this when you use smart pointers in C++.. "who owns this reference?" etc.. But in C++ this is a library.. not a syntax.. point to rust for this

You already have to think like this when you use smart pointers in C++! But C++ compilers don't help you with that! The Rust compiler does. Using Rust, you get surprised how often you get ownership wrong, because the compiler tells you every time. The same analogous code in C++ will still be wrong, but you wouldn't know, since the compiler tells you zilch.

Re: Using Rust for an Undergraduate OS Course

#47
post #32

Earlier quoted context omitted.

> it seems initially it was meant to be those kind of "systems" From the announcement talk: "And it's a systems language in the sense that we intend it to be used to write things like web servers" http://www.youtube.com/watch?v=rKnDgT73v8s I don't think that Google ever wanted to develop a new OS kernel.

> From the announcement talk From the announcement blog (and that was the widely circulated quote in tech news not the video transcript): --- Go combines the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++. [...] And the compiled code runs close to the speed of C [...] Go is a great language for systems programming with support for mu…

Jeez.

These dudes were writing "systems" long before most folks here on HN were programming.

To me, and to them, "systems programming" has a particular meaning that does not include kernels. Like it means assemblers, compilers, web servers.j

I think they have more credibility about what it means than perhaps you do.

Re: Using Rust for an Undergraduate OS Course

#48
post #32

Earlier quoted context omitted.

> it seems initially it was meant to be those kind of "systems" From the announcement talk: "And it's a systems language in the sense that we intend it to be used to write things like web servers" http://www.youtube.com/watch?v=rKnDgT73v8s I don't think that Google ever wanted to develop a new OS kernel.

> From the announcement talk From the announcement blog (and that was the widely circulated quote in tech news not the video transcript): --- Go combines the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++. [...] And the compiled code runs close to the speed of C [...] Go is a great language for systems programming with support for mu…

> As the meme goes, they keep using the word "systems", I don't think it means what they think it means.

I'm pretty sure it doesn't mean what you think it means. The only title I have on my bookshelf which has "Systems Programming" in the title is System Software: An Introduction to Systems Programming. The book is about creating assemblers and compilers for a made-up architecture called SIC: http://en.wikipedia.org/wiki/SIC/XE

This is neither here nor there, but the point is that a fair number of accomplished people in the field were apparently at one time less hung up about precisely what "systems programming" might mean and (this is just conjecture on my part, since honestly, who cares?) probably just used it as a contrast with applications programming.

Re: Using Rust for an Undergraduate OS Course

#49
post #31
post #6

> Go. Go is a systems programming language Not those kinds of "systems". It is funny, it seems initially it was meant to be those kind of "systems", and then it pivoted as we like to say, to become a "distributed-server-network-backend systems" not "hardware-kernel-OS" kind of systems. And then creators kinds of winged it and remarked how "well, that's what we meant when we said systems". As for Rust, yeah, there are…

Rust is a high-level systems programming language. Go is a low-level managed language runtime

This is probably the best clarification I've read regarding the difference between Go and Rust. They operate in different domains, and any competition is out of confusion over definitions (the source of many needless disagreements throughout human history).

Re: Using Rust for an Undergraduate OS Course

#50
post #47
post #32

Earlier quoted context omitted.

> From the announcement talk From the announcement blog (and that was the widely circulated quote in tech news not the video transcript): --- Go combines the development speed of working in a dynamic language like Python with the performance and safety of a compiled language like C or C++. [...] And the compiled code runs close to the speed of C [...] Go is a great language for systems programming with support for mu…

Jeez. These dudes were writing "systems" long before most folks here on HN were programming. To me, and to them, "systems programming" has a particular meaning that does not include kernels. Like it means assemblers, compilers, web servers.j I think they have more credibility about what it means than perhaps you do.

Before many HNers were even born too.
Post reply on HN