Replace C++ code with Rust


#1

There is another Operating System called Redox OS

https://www.redox-os.org

It is purly written in Rust.

Reasons why we should use Rust over C++ is because:

  • OOP is slower than POP (as Rust is POP)
  • Rust has strict compiler checks and the rust concept borrowing make a lot of common programming and memory bugs nonexistant. Though that’s not to say you can’t have bugs in rust.
  • Easier to code than C++
  • Quicker to develop compared to C++

Check out Redox OS’s website for more info.


#2

Technically it is too late for beta, too early for R3, but send a PR with your changes nevertheless…


#3

Cheeky. :smile:


#5

What do you mean by that?


#6

I intended to comment miqlas’ post…


#7

Oh lol, you do you realise that to reply to a specific person you click on the reply buttom that is next to the person’s post, just saying mate :slight_smile:


#8

Saying that C++ isn’t procedural is kind of misleading. And it seems you don’t understand the subject. C++ is mostly a mix of procedural, imperative and object oriented paradigms. But in general strictly classification of languages doesn’t work, because you can always isolate some features which are part of another paradigm.

Now, that rust is better to develop an operating system is all to demonstrate. Almost all modern mainstream operating systems are written in C or in some variant (Objective-C, C++, C# and so on), and there should be a reason, right?

In general there’s no language that’s better than another, but it’s very hard to reach the same mix of abstraction and closeness to the CPU that you can get using C/C++, that’s why it’s so popular among operating systems.

In any case, moving Haiku from C++ to rust would be basically a complete rewrite, so why you just don’t use Redox?


#9

Redox is in pre alpha, why would I use that?

Ok you have made your point, but what about any future developments, anything new should be written in Rust instead of C/C++?


#10

You suffer from the RIIR syndrome. But don’t worry, your case has been reported to the appropriate place:


As far as we’re concerned, Redox OS is doing a great job at writing a Rust-based OS so far. Let’s see how fast they manage to catch up with our C++ based design!


#11

I’ve heard from some folks who have dabbled in Rust to say that it’s really hard to code in. Variable management was one of the complaints IIRC.


#12

Lol XDDDDDDD
very funny


#13

What a splendid idea! I think we should consider a rewrite in Rust, but it should include a mix of code in the Aluminum programming language. Aluminum is lightweight, flexible, shiny, and really strong! For best results, the ratio of code in Aluminum and Rust should be 27:80. This will of course be a fork of the official Haiku codebase and be called ThermiteOS and include a strip of magnesium as a bootloader.


#14

where do i download this ThermiteOS it sounds so hot right now


#15

The difficulty is, if you don’t get the stoichimetric mix of the two languages just right, it doesn’t work very well. MIght fail to boot at all…


#16

I’d like to be able to use Swift. It seems kind of neat.


#17

As someone who slings some Rust, I agree. However Rust is pretty good (and getting better) at telling you what you’re doing wrong and how to fix it.


#18

Is possible to write a driver with rust for haiku right now? Or it is not possible and why? And if it is possible then can be a good idea add to haiku book.


#19

No. Haiku is C++. Someone would need to write bindings in rust for our libraries.


#20

Sad but anyway rust is not installing for haiku x64, but it can be good at least not replace all the source but can be writed some drivers and start to get some advantages in in there better than rewrite maybe.


#21

Haiku is c++. our dev team knows c++. As I already said, if you think the programming language used is the important thing, go install redox.

Haiku is not going to switch to another language ore use two of them in parallel. This would only lead to more complexity, new bugs (because of people not being familiar with the language) and more problems for newcomers (suddenly you need to learn two languages and install two compilers).