Rust in base

Ihor Antonov ihor at antonovs.family
Mon Jan 27 17:01:25 UTC 2020


On 2020-01-27 08:56, David Demelier wrote:
> Le 24/01/2020 à 21:02, Ihor Antonov a écrit :
> > Hi folks,
> > 
> > As I was reading this article [1] I started wondering what would it take to bring Rust into base?
> 
> That would be a very bad idea.

Thanks for your answer, I see your point, although there are things that
are technically not correct in your statement, and I'd like to comment
on them - too many people have misconceptions about Rust.

> Rust is big beast, it does not support the same number of platforms as
> FreeBSD does 

FreeBSD uses clang to compile, and clang uses LLVM as a backend, so as
Rust. So theoretical number of platforms that both platforms support are
the same. Looking at links below I think it is not fair to say that
FreeBSD supports more platforms:

https://www.freebsd.org/platforms/
https://forge.rust-lang.org/release/platform-support.html

> and is utterly complex.
Well so is clang and llvm, but these are in base. And there are people
who would like to have options to have a slimmer base (embedded as an
example)

> 
> Not mentioning that cargo, the package manager for Rust is built upon the
> same philosophy as npm, aka having a separate module for minimalistic
> functions. That means even small applications like alacritty requires around
> ~50 dependencies which is totally insane. Also, building a Rust application
> without internet connection is quite hard (but still feasible).

It speaks more about disadvantage of C than anyting else. In C you have
only 2 options - hope that necessary dependency is supplied by your
operating system (or system's package manager) or bundle the dependecy
whith your code. The latter is especially bad because it prevents code
re-use, and such dependencies often left unmaintained, because they are
hardly relevant to the goal of the main part of the codebase (look at emacs for
example).

With rust you have these options too, but also you have language package
manager, so you can re-use the code that is maintained by someone.

> Rust is far more complicated language to learn than C. C is so minimal and
> low level that you have already almost the view of what will the code look
> like in assembly when writing C, thus being the best fit for kernel and
> drivers.

I can argue that writing kernel or dirviers requires fair amount of
knowledge and skill too, and complexity of Rust in this comparison looks
tiny. And Rust's complexity comes with memory safety guarantees, and as
we all know memory related bugs are very common in C (simply because
humans can't write safe C in general).

As Polytropon said - FreeBSD is moving towards modularization of base.
So rustc is not going to be included, even more so, I think even clang,
sendmail and other non-essential things will be modularized and become
optional.

My question was not about adding rustc to base. It is more about how to
allow low-level software written in Rust available to users. How FreeBSD
project can stimulate and ecourage those who want to write kernel
modules in Rust:

https://kth.diva-portal.org/smash/get/diva2:1238890/FULLTEXT01.pdf

Without community support these efforts will remain academia experiments
and will be forgotten. It is sad to observe how people in this thread
unilaterrally sceam "NO!", without even reading into the question.



> 
> -- 
> David
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"


More information about the freebsd-questions mailing list