Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jan 2024 11:15:10 -0600
From:      "Robert R. Russell" <robert@rrbrussell.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: The Case for Rust (in the base system)
Message-ID:  <20240123111510.23aa4e18@venus.private.rrbrussell.com>
In-Reply-To: <48FF6847-FCF0-4B6D-AC67-E3B939294847@FreeBSD.org>
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> <20240121102421.GE14773@memo2.memo.frmug.org> <2f38cbcd-61a9-42b7-b7e6-ebd261fe66da@FreeBSD.org> <20240122164543.066e3cec@venus.private.rrbrussell.com> <D846A8E3-1FE3-4A82-B9C3-5FA3BE7406A0@FreeBSD.org> <20240123085540.42f8b70c@venus.private.rrbrussell.com> <48FF6847-FCF0-4B6D-AC67-E3B939294847@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 23 Jan 2024 15:04:31 +0000
David Chisnall <theraven@FreeBSD.org> wrote:

> On 23 Jan 2024, at 14:55, Robert R. Russell <robert@rrbrussell.com>
> wrote:
> >=20
> > The specific anti-patterns is was thinking of in both instances is
> > called Meta Template Programming. Back in C++03 I just used the
> > template system as a form of generics. In that role it works well
> > and with the new smart pointers definitely improves some of the
> > older problems C++ had. =20
>=20
> Template metaprogramming is a core feature of C++, and more recent
> versions have added constexpr / consteval / constinit and concepts to
> make it a lot more readable.  It can be abused, but it is not, in
> itself, bad.  My example from earlier in the thread used template
> metaprogramming to do compile-time checks of correctness of the
> overflow / wrapping behaviour of a ring buffer.  Making it easy to
> check properties of your code at compile time is very much a feature,
> not an antipattern and it=E2=80=99s hard to see how you could argue the
> converse without arguing that bugs are a good idea.
>
>=20
> > However, C++ definitely has a complexity cult and a ricer cult in
> > its community. The overlap between the two appears to be fairly
> > large which worries me. =20
>=20
> Non-specific ad-hominem arguments are tremendously unhelpful.

It sounds like I could read the code you talked about and grasp what
the intention was even if I didn't understand exactly how you were
achieving the task. The groups I was commenting about have a preference
for people not being able to do that. The "Ricers" use speed as their
justification.

> > I have less reservations about C++ than I did earlier, though I
> > think the build system may require major surgery to support it
> > well. =20
>=20
> The build system for both userspace and the kernel already support
> C++.  I have written a kernel module in C++ in the past.  Currently,
> there=E2=80=99s no mechanism in the kernel loader to support COMDATs (and=
 I
> don=E2=80=99t really want to add it, I=E2=80=99d much rather handle them =
as an
> install-time preprocessing step for kernel modules), so you can=E2=80=99t
> load kernel modules that use inline functions / variables, but that=E2=80=
=99s
> orthogonal to the build system.
>=20
> David
>=20

I was mainly thinking about handing things like setting the proper
variables so the LSP servers work or being able to do some static
analysis before commits.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240123111510.23aa4e18>