From nobody Tue Jan 23 15:04:31 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TK9Nr1xnBz570ZK for ; Tue, 23 Jan 2024 15:04:44 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TK9Nr1Bgtz4XPH; Tue, 23 Jan 2024 15:04:44 +0000 (UTC) (envelope-from theraven@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706022284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d59VUNBEAvwEPeSlNx9L5hzJtOZK3K+F+qkwAx55+Kw=; b=ZmBSjUGsuyjDvlKRFtcxiU4D4xwIAQbnGhRhgrZtC2m/othAU+NqY8+IrFqXuRK1flbwq4 zh1fXhekPl4CybgEET1jWCNZ/HjklY2Hp7IYkve6o0k9qTHUH8rPMwicgfv0JkLgXiRN1U 5KtB3sOeym8HGpxBRChzxdGZLUK0W421zB0nQ8N7LLqcPq/8TBGzWE2slaexUdk0wmDoUW z3ltbGwv++kz2sICre+O/vrZ5z1e1YjHRCmJcIqq2mKtulx/BLpI2ZepBU4G29Vj2KVEMk uyNSoR7Co++26D+vTw7eGEU0EYFdEA42bV6NAfKuTTQ9qbHbl0ZzoeAJam/EkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706022284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d59VUNBEAvwEPeSlNx9L5hzJtOZK3K+F+qkwAx55+Kw=; b=hr6OI8dxin5U4HepoSN67ebJlrocwPwYxecnDFf6Wnb9FmVlo95Y1Sf8i8pe44re6DdTdw ogNbTlMu+dAOIl9KLkfnZdXT/JibLbp6GYhmd6d5RG+VanQ8ICELb/XW0R1QOSuz/fYx1o cYyEYOzdOVU0Uj5LKiPh02QF09dISCLYcMEys7ab9gCa0mkAjJW4X2+smT+bKWHENVIbf8 hwNouGlYkzQTjsI15MwfO4LRHMoUGSvIZtPFBxxqXETcjXTfFWeTM7OiQIcGiUyFVG0FLn fM8ICczfJAhziKVK+U8M2Q27fvvIEYiLNvvRNtfXCIFFCKz3795PBjOfJuvW+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706022284; a=rsa-sha256; cv=none; b=PztNCmMNMNl67RzjDp3zM9J5ZrgkIdva7PqzyE2WzoI4AwHN1b8YKAzYlxHxFTs7LywPgq qmGFvDoz5EOgiDp8+8tSaNtSTRZv3d3PsptXVP7MX4MTPhxhgrwHUE3FxmbuKaPBGHPJ9L o7e6T6alK9EWF6Rq1xrgOR2WGGRruLcW3azPtne4V6DEXTgSKa181daI2wXoUUqqJ94gJt 6Qx8JPZcCWqcLwcJAueZ6GX+17BiGzwrYY+3Z6OMFNgWGMxrPvjVSrwHJbMlfTWeZoUKfK DviWD/UtqJLZ10viD/vpyge9c7CrtxfMtn39FM5+qdM0thzaGPCiJoDFvXvw3g== Received: from smtp.theravensnest.org (smtp.theravensnest.org [45.77.103.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: theraven) by smtp.freebsd.org (Postfix) with ESMTPSA id 4TK9Nr05Gkz1Lb3; Tue, 23 Jan 2024 15:04:43 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtpclient.apple (host109-153-95-118.range109-153.btcentralplus.com [109.153.95.118]) by smtp.theravensnest.org (Postfix) with ESMTPSA id BAA98BF4F; Tue, 23 Jan 2024 15:04:42 +0000 (GMT) Content-Type: text/plain; charset=utf-8 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.200.91.1.1\)) Subject: Re: The Case for Rust (in the base system) From: David Chisnall In-Reply-To: <20240123085540.42f8b70c@venus.private.rrbrussell.com> Date: Tue, 23 Jan 2024 15:04:31 +0000 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <48FF6847-FCF0-4B6D-AC67-E3B939294847@FreeBSD.org> References: <1673801705774097@mail.yandex.ru> <202401210751.40L7pWEF011188@critter.freebsd.dk> <20240121102421.GE14773@memo2.memo.frmug.org> <2f38cbcd-61a9-42b7-b7e6-ebd261fe66da@FreeBSD.org> <20240122164543.066e3cec@venus.private.rrbrussell.com> <20240123085540.42f8b70c@venus.private.rrbrussell.com> To: "Robert R. Russell" X-Mailer: Apple Mail (2.3774.200.91.1.1) On 23 Jan 2024, at 14:55, Robert R. Russell = 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. 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. > 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. Non-specific ad-hominem arguments are tremendously unhelpful. > I have less reservations about C++ than I did earlier, though I think > the build system may require major surgery to support it well. 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=99= s orthogonal to the build system. David