Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jan 2024 09:29:12 -0800
From:      Ihor Antonov <ihor@antonovs.family>
To:        Alan Somers <asomers@freebsd.org>
Cc:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: The Case for Rust (in the base system)
Message-ID:  <c0929000-3fea-4039-860b-fabdd8dfe581@antonovs.family>
In-Reply-To: <CAOtMX2hppfdu5ypDdGpfw_QDcd1rwJEeyVfSk9ogFEm7CiV6Kw@mail.gmail.com>
References:  <CAOtMX2hAUiWdGPtpaCJLPZB%2Bj2yzNw5DSjUmkwTi%2B%2BmyemehCA@mail.gmail.com> <1673801705774097@mail.yandex.ru> <CANCZdfpqWgvV_RCvVO_pvTrmajQFspW%2BQ9TM_Ok3JrXZAfeAfA@mail.gmail.com> <ef4ad207-5899-42b6-8728-bc46f1417e9e@antonovs.family> <202401210751.40L7pWEF011188@critter.freebsd.dk> <40bc1694-ee00-431b-866e-396e9d5c07a2@m5p.com> <CAOtMX2hppfdu5ypDdGpfw_QDcd1rwJEeyVfSk9ogFEm7CiV6Kw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/21/24 08:04, Alan Somers wrote:
> * Why Rust instead of Perl, Java, C#, or Go?
I have more interesting questions:
- What are we going to do when Mojo comes out?
It is a compiled superset of python that will have a better borrow 
checker and is
going to be suitable for low-level systems development?
Chris Lattner  - they guy who wrote LLVM is building it, and he says 
Rust's approach
is not the best. There will be a new hype wave. Productivity gains from 
mojo *will* outshine
Rust. [1]
- Are we going to add python/mojo to the codebase?
- Are we going to remove Rust?
- It is not about Rust per-se. How many more languages can we add to the 
src before it becomes
  an unmaintainable mess?
- What is our vision and policy about languages in src?

[1] https://docs.modular.com/mojo/
> * Why not just use C++ then?
>
> Speaking from experience, I'm far more productive in Rust than C++
Same. But I'm afraid personal productivity comes at a cost of decreasing
our collective productivity. Shifting mental gears from C to Rust is hard.
It is much easier to shift from C to C++ (a reasonable subset thereof).
Also - have we tried using C++ as if it is C? Read what PHK writes.
We don't have to use all C++ features. We don't have to learn all of C++.
I have a working prototype of C++23 codebase where I write C++ as C but with
- methods on structs
- namespaces
- modules (C++20)

No STL, no templates, none of the C++ insanity.
This just makes a better C. Yes, I know that defining and maintaining a 
"sane" C++ subset
is not trivial, but it seems to be like a much better way to evolve src.

> * Rust will go out of fashion by the 2040s
Yes, it is only the first systems language that has borrow checker and 
no GC.
Mojo is coming. There will be more..

...
BTW, Someone mentioned Zig and I want to develop this idea further.
Zig in base is actually not a crazy idea at all! I am currently playing 
with Zig and ZIg is great.
- It mixes with C much better than Rust.
- It can be bootstrapped from vanilla LLVM.
- It has conservative mindset - much closer to C and Go rather than C++ 
and Rust.
- Productivity gains are as great as in Rust, or bigger.
- Zig foundation has not been (yet) overrun by corporate overlords.


> [1] Yes I know about Modula-3, D, etc.  But for various reasons those
> never gained traction.
> [2] Dumb pointers exist too, but they're almost never used except when
> binding to a C library.
> [3] https://github.com/lpabon/cmockery2/blob/master/doc/usage.md
> [4] https://docs.rs/mockall/latest/mockall/
>

-- 
Ihor Antonov




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c0929000-3fea-4039-860b-fabdd8dfe581>