I’m fairly sure the decision of what language to develop the system with is on the developers who write the code, not the end-users.
As I said, the main reason to keep doing C++ is because everyone writing code in Haiku knows C++. It is difficult to find another language that everyone in the developer team is happy with. So that means you have to make a choice between two options:
- You can keep C++, for better or worse, and keep the existing developers
- You can decide to switch to another language that some of the existing developers will not know or not like. This means these developers will not want or not be able to contribute to that part of the OS
The first options is “business as usual” and doesn’t need extra commenting. Let’s look at what the second one would do.
First of all, some developers may just leave. So that’s lost knowledge.
Second, the code must be rewritten, which means inevitable subtle changes in behavior, especially because our unit tests are in extremely bad shape and so they are useless. And at this point you want to turn to the old developers to see if they remember what they did in the old code. But they left the project, so you don’t know.
And then, there are the people who remain in the project but don’t know the new language. This means now there are some parts of the project that are rewritten in a language they don’t know. At best they can read the code to understand what it does. But, they are not able to do code reviews for it, and even less able to contribute patches to it except for the most trivial changes. So, we loose one of the key “selling” points of Haiku: we believe that having the whole OS developerd by a single team, where everyone can seamlessly jump from GUI to kernel development, allows us to provide a tightly integrated and consistent OS. This will not be the case anymore.
As long as there isn’t a complete rewrite, there are areas of friction. Let’s say for example that the kernel is rewritten in Rust (I’m using Rust as an example here but you can replace with any other language you want to see used) but userland stays in C++. And let’s say we want to be more “microkernel” and move some code from kernel to userspace. What do we do, do we rewrite the Rust code in C++ when moving it? Do we allow Rust and C++ to coexist in both the kernel and userspace? How does that even look like, given that the Be API is heavily tied to C++? A mixed languages setup forces us to completely redesign an API that works on the “smallest common denominator” of the two languages, making it a nightmare for both Rust and C++ developers. Or, if we don’t do that, to design two independant APIs, and again, the “system consistency because a single team is in charge of everything” goes down the drain.
That’s the main problem here. You can discuss the merits of various languages as much as you want, of course, obviously, there are many modern languages that may be a better fit if you are writing an operating system from scratch. But we are too far deep in our own little C++ hole now. I think that’s OK, maybe you don’t agree, but in any case: this is a human problem and not really a technical one. Would a new programming language work, if analyzed “in a vacuum”? Yes, probably. Would the existing developers instantly switch to it? Probably not, for many reasons.
I hope to see Redox OS (for the Rust supporters) get as much success as we do. And I hope to see the other languages get their own OS as well (some may already exist, I don’t have an eye on everything). And if one such language allows to do things 10x easier or 10x faster than C++, surely that project will catch up and do better than Haiku. Maybe some of the team members will “jump ships” and start contributing there and using that better OS.
Or, if you somehow think starting from Haiku and gradually rewriting it in another language is the better way forward, sure, start hacking on that! Let us know how far you get, it’s exciting to see Haiku codebase used in ways we didn’t expect it would be!