Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2018 09:36:18 -0800
From:      Enji Cooper <yaneurabeya@gmail.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Eric McCorkle <eric@metricspace.net>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Speculative: Rust for base system components
Message-ID:  <713BA6E4-1C4E-4890-831F-6379D3AB4425@gmail.com>
In-Reply-To: <CANCZdfrMY73-7vK6F6q-iPdW7EOUP8CPThkyxwOoOWedyMu5Ag@mail.gmail.com>
References:  <ca76e5f7-6e59-bd67-144a-90ad66f0252e@metricspace.net> <CANCZdfrMY73-7vK6F6q-iPdW7EOUP8CPThkyxwOoOWedyMu5Ag@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_6C9CE56A-9633-4CBD-BFCA-F045A9DD52B4
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Dec 31, 2018, at 7:02 AM, Warner Losh <imp@bsdimp.com> wrote:

=E2=80=A6.

> TBH, there's a stronger case for python than rust: there's actual =
python
> scripts in the tree today that we have to install a port to use. And =
there
> the benefit, while not zero, is small and the effort is large compared =
to
> just dragging it in as a port, so it hasn't been done. It's another =
fast
> evolving language that requires multiple versions as well...
>=20
> So write something that everybody wants, that must be in base, and =
that
> requires rust, and then we can have the conversation=E2=80=A6

As someone who has been using python extensively over the past decade, I =
think that using python versions less than 3.7 without type hints to =
ensure that the data types are correct [1], mocked tests to ensure that =
the code functions and is tested, is the wrong path to make.

Rust is still a young language, but it has a number of benefits in terms =
of:
i. Being able to scale past JIT python. This fact doesn=E2=80=99t matter =
on workstations/servers, but it definitely matters on the low end with =
embedded systems and the upper end with distributed systems at scale =
(there=E2=80=99s a reason why a number of critical services at my =
previous longterm employment were written in C++, not python. Some argue =
Rust can outperform C/C++ [2]. C++ I can see (managed pointers were =
about an order of magnitude less performant in a microbenchmark I wrote =
for grabbing the time in the Linux kernel vs malloc in C using llvm36). =
However, outperforming C is up for debate.
ii. It is easier to grok than C++ (even the most recent versions of the =
C++ spec, the language is cryptic in areas).
iii. It is more reusable than C out of the box. How often do we need to =
rewrite common logic/routines in C and mimic an OOP language like C++ =
(see libarchive, pkgng)?

<offtopic>
At the end of the day, I think the key is that the FreeBSD project needs =
to start expressing more complicated subsystems in terms of OOP =
languages, like C++, Rust, etc, instead of expressing most of the code =
in C. I do think (for instance) a service management system would be a =
good candidate for modern C++ or Rust.
</offtopic>

Cheers,
-Enji

1. https://www.python.org/dev/peps/pep-0484/ =
<https://www.python.org/dev/peps/pep-0484/>;
2. =
https://www.reddit.com/r/rust/comments/5urar1/is_rust_likely_the_next_fast=
est_language_after_c/ =
<https://www.reddit.com/r/rust/comments/5urar1/is_rust_likely_the_next_fas=
test_language_after_c/>

--Apple-Mail=_6C9CE56A-9633-4CBD-BFCA-F045A9DD52B4
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5bk3FaGcY5rvqmb79YOpJmkwhhUFAlwqU5IACgkQ9YOpJmkw
hhVtHw/+IvKHRnJaUQnSKrVPvYkOcJIdWPfo9NEPp3rArjYDI7igHdqsWoimZvn3
HsIG6D/Uv7u9Nh9//f1KA9Ru06pv8F57+6PoPU7/Rndm/tOCnfA50Ta8Mz9Z0Cvg
H7bNqpQj27yc0xNgruPNl/Y52mOotBtBvgRY5llEepdjcckV0wn4TOVr4JoNEqgi
wItiM970n/TGRDIqOuEQnP+WmiaDO5xuJcKrzh7TV7Vwk2IPOW4TTSlomkvZQeHO
ddHhrwTYjlpw9inrnBcP3IdmQObI5D/GE1gLCLfOd2HKWZfjAKCPQwudMH7jBKWH
If+s50q6r6bzOxdCxKEDiVyiFIug5pAKScq5zdeSizAEg4h/ph1eTJdUshxRU4ed
mY7aoIPAu0evyzqXXor2t5/GXGPIAV4rtNjQo/a9p4SsPBhsxUAWxmmU+wxdc2Z9
XXgNkKV7WXERCrGGeDsZGVLF1cdzrQmSp5A0wQSlSYstlURwJe7f8AZArdQvfyiU
Lb7SzZXpLvD5lTaTjqY4f7dqsDWgmGPQw7JbAcCPkhqsOfcnPk6u/JJLFKpkqDyk
OA8tTVe2cswKBHmXij6aEX/0eXKzJJnT70XZPH6JZ1Og8PXpIV+eWTrwc+AIrOd8
dpSFVuaz2YmkcSHHNsvoY3VQp7lraBjLWtBcSw0i/5WOOn5bZlI=
=LrDW
-----END PGP SIGNATURE-----

--Apple-Mail=_6C9CE56A-9633-4CBD-BFCA-F045A9DD52B4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?713BA6E4-1C4E-4890-831F-6379D3AB4425>