Other Rust-Lang and C\C++.

hack3rcon

New Member

Reaction score: 2
Messages: 16

Hello,
Is it true that Rust-Lang is a replacement to C\C++? What is the plan of FreeBSD about it? Is it possible that FreeBSD rewritten in Rust-Lang?

Thank you.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,106
Messages: 39,696

kpedersen

Son of Beastie

Reaction score: 2,238
Messages: 3,064

Is it true that Rust-Lang is a replacement to C\C++?

Before Rust can replace C or C++ it would, itself need to be fairly rewritten to get away from a dependency on LLVM which is entirely written in C and C++.

So at this point in time it is fairly safe to say Rust cannot even exist without C and C++.

Though my personal opinion is that the technical debt racked up by crates.io will kill the language long before it penetrates the industry.
 

msplsh

Aspiring Daemon

Reaction score: 250
Messages: 668

It's (probably) good to write new stuff in Rust and link it to C.

It's unnecessary to decided to rewrite everything in Rust.

If something needed to be rewritten, Rust is not a bad choice.
 

drhowarddrfine

Son of Beastie

Reaction score: 2,492
Messages: 4,437

If anyone wants to replace C with Rust, I would want a 30-page report on my desk by morning outline all the technical details as to why it should be done.

iow, tell us the why before you tell us anything else. Even then, your job won't be complete.
 

sidetone

Daemon

Reaction score: 942
Messages: 1,894

The Cargo system of Rust is like its own operating system environment. It's difficult to see how that would coexist with an operating system's ports/package system. It works, but it seems redundant, as to what extent does it obsolete or duplicate ports/packages.

Rust looks well designed, and it uses logic to reduce vulnerabilities. Reading about it looks difficult though.

It's good that it's one programming language that covers programming functionalities of C and C++.

Does Redox have its own Rust compiler? Redox wouldn't be ideal, as IIRC, it lacked the ability to connect to the Internet. It lacks a lot of basic drivers as well.

It would be good for C/C++ to be replaced, but if it's Rust, it needs to be an implementation that doesn't use the Cargo system, except maybe for libraries only.
 

ekvz

Well-Known Member

Reaction score: 282
Messages: 431

If anyone wants to replace C with Rust, I would want a 30-page report on my desk by morning outline all the technical details as to why it should be done.

iow, tell us the why before you tell us anything else. Even then, your job won't be complete.

Obviously not going to happen. It's one of those threads again where someone read a bunch of headlines and decided it was enough to draw conclusions how flavor of the day buzzword is the most important thing since the invention of the bit.
 

vigole

Daemon

Reaction score: 1,601
Messages: 1,413

Once upon of time I used to search the Internet to find answer to similar questions, e.g. "vi vs. emacs", or "C or c++, which one is better". Then I started to learn c and vi. Result: no more such questions. Strategy: to start a reading habit, K&R, the Handbook, man(1), etc.

Sigh. Why does everyone always think new languages are going to replace existing ones?
It is "new is good, old is bad" ideology.
 

Jose

Daemon

Reaction score: 1,157
Messages: 1,371

Back when C++ was the sexy new thing, attempts were made to write a kernel in it. A colleague of mine spent a lot of time sweating bullets working on Nachos for a college operating systems course. One of the big stumbling blocks was the fragile base class problem.
 

ralphbsz

Son of Beastie

Reaction score: 2,507
Messages: 3,371

You can write C++ in the Linux kernel. I've done it. So now you can write Rust in the Linux kernel too. I think that's wonderful ... for those people who feel like writing some Rust. But it doesn't mean that there is any need to rewrite existing stuff in a new language. Different problems often call for different languages. Even different parts of the kernel might be better served by different languages - to each their own.
 

George

Aspiring Daemon

Reaction score: 215
Messages: 526

What is the plan of FreeBSD about it?
There is a proof of concept driver module written in Rust on github. If you want to write kernel code in Rust, you are free to start there. :)

RustBSD, "FreeBSD userland rewritten in Rust", is another github project. It seems dead.
https://github.com/rhelmer/RustBSD
 
OP
H

hack3rcon

New Member

Reaction score: 2
Messages: 16

Thank you for all of your replies.
I asked it because I want to improve my programming knowledge, but the problem is that if Rust-Lang is a replacement for C\C++ then I wasted my time. I like to have a low level knowledge of operating systems. I hope you understand my concern. You learn a language but nobody need it in the next years and its usage decreased.
Another problem is that, if developers started rewrite a big project like Linux or BSD in Rust-Lang then they never reveal it and when it done then they surprise users.
It was my reason to ask this question.
 

sidetone

Daemon

Reaction score: 942
Messages: 1,894

Another problem is that, if developers started rewrite a big project like Linux or BSD in Rust-Lang then they never reveal it and when it done then they surprise users.
Redox OS would be a much better starting point, as its base is already in Rust. If C/C++ can be used with it for advanced hardware drivers.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,106
Messages: 39,696

but the problem is that if Rust-Lang is a replacement for C\C++ then I wasted my time.
Learning a programming language is never a waste of time. It's all about learning structure, abstractions and decision making. That's the same in pretty much every language. The only differences might be in the exact syntax. But the syntax is the least important bit of learning to program. Once you learned one programming language it's quite easy to learn a second, third, etc. because the basic principles all remain the same.
 

vigole

Daemon

Reaction score: 1,601
Messages: 1,413

Engineering is not science or mathematics. Kludge, trial and error, and debugging. Wasting time is inevitable. But reading and practising, especially C language and PC architecture, is not one of them.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,106
Messages: 39,696

One important factor needs to be taken into account, you need to learn to deal with failure. Because you're going to make mistakes, a lot. And that's fine, find out why it was a mistake, learn from it, don't be put down by them. The one thing that initially attracted me to computers is the way a computer works. It does exactly what you told it to do. Unfortunately, what you told it to do is often not what you meant it to do. And computers have an uncanny ability to point out those failures. The computer isn't wrong, you just told it to do the wrong things. It's your mistake, not the computer's.
 
Top