From nobody Tue Jan 23 14:55:40 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 4TK9BW4SQcz56yfb for ; Tue, 23 Jan 2024 14:55:47 +0000 (UTC) (envelope-from robert@rrbrussell.com) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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) by mx1.freebsd.org (Postfix) with ESMTPS id 4TK9BW2ZVDz4VM4; Tue, 23 Jan 2024 14:55:47 +0000 (UTC) (envelope-from robert@rrbrussell.com) Authentication-Results: mx1.freebsd.org; none Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id D894C3200B15; Tue, 23 Jan 2024 09:55:44 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 23 Jan 2024 09:55:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rrbrussell.com; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1706021744; x=1706108144; bh=7pqcRhDkR0TJM0JLvSei35z1vovUWxCbIYgf92tCjpQ=; b= YsK2vv7CuYhJ8aYfE63zd1gqq82JCfx39267LeUhAzOmdJlqxhGHAoDYRryK9l9p 2hQvnrlhUpUhYndnpz0x2ID853bN2970Pb2MqxTpmRPPObmvLwf2yUR2RQtMcs40 cSHmKQYwsJV/Fyz1vHyiQaV48UKvxq10THt/y3HqGEtTXpdjrfAF/Rjfg4VSxZx1 nSlCLLajXsIalv7XjE6nhzpWcpEYN3GPVYjUYyaRswJDFykvzHsA4FhWOwQDNuAT TPcPe2Zqtdq6kXufN6wCEXNVQc0/UzBeCP2/hm4+YvsValeQD0QOfz5JGhPvs5Nz sLNvr3YNkfzXc2PGbyrnQA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1706021744; x= 1706108144; bh=7pqcRhDkR0TJM0JLvSei35z1vovUWxCbIYgf92tCjpQ=; b=a BKBCwFkuU9Z7c26OsKhBHBLilcj6M6nOEnQM6TK1ZgtDUJKJM9DhAdn/6IzdnT8E qf8RP6qx7TntRV8KjNnYHLmbCO+0FXo2OTUjdt5uPIDoJlfL8LT37CwgiPgtwo8K cyyuXQS1NKJGRBwvCSt/rmcJH7WEQ7fT/rjoztJHX48SrcsSEW4Vt7PyK6bTkx54 7+lSAV3BALQqQSKSGxrwiUVDiVw+aw85mDwrLvaCMVZxX1gLq69ZcbFazjUnCfyH NCifbU3jKXDvoq2nKrfgz40/m4mMk+ICWMnhDYnFSQ27yvuxkLdIXQS6BGd0vz0g 0y4s2GiBrNrnDSxg8lBAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdekkedgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkjghfofggtgfgsehtqh ertdertdejnecuhfhrohhmpedftfhosggvrhhtucftrdcutfhushhsvghllhdfuceorhho sggvrhhtsehrrhgsrhhushhsvghllhdrtghomheqnecuggftrfgrthhtvghrnhepleekle fhhfeiteetfefhiefhleeivddutdekgeduveetheettdejfedvuddtheevnecuffhomhgr ihhnpehgihhthhhusgdrtghomhdprhhunhgptghlrghnghgpthhiugihpghfohhrmhgrth drshhhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep rhhosggvrhhtsehrrhgsrhhushhsvghllhdrtghomh X-ME-Proxy: Feedback-ID: ie421460a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 23 Jan 2024 09:55:43 -0500 (EST) Date: Tue, 23 Jan 2024 08:55:40 -0600 From: "Robert R. Russell" To: David Chisnall , freebsd-hackers@freebsd.org Subject: Re: The Case for Rust (in the base system) Message-ID: <20240123085540.42f8b70c@venus.private.rrbrussell.com> In-Reply-To: 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> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4TK9BW2ZVDz4VM4 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:29838, ipnet:64.147.123.0/24, country:US] On Tue, 23 Jan 2024 09:41:01 +0000 David Chisnall wrote: > On 22 Jan 2024, at 22:45, Robert R. Russell > wrote: > >=20 > > Having had the luxury or curse of not being stuck with only one > > programming language I have learned usable pieces of several. C++ is > > not on that list even though I have the most formal education in it. > > My best way of answering why is this. Would you write or use a C++ > > codebase maintained by the average developer with just Vi? Up to > > C++03 I can say yes, after that the answer is no. =20 >=20 > I have no idea what this means. There=E2=80=99s absolutely nothing in ne= wer > C++ that makes it harder to write with a text editor. There is a lot > that makes it easier to write correctly. > > For reference LLVM is about 4MLoC (and about 5M lines of comments, > something that FreeBSD could definitely learn from) and is written in > modern C++. I don=E2=80=99t think I=E2=80=99ve ever used an editor other= than vim to > work on it. I don=E2=80=99t use nvi, because it=E2=80=99s not the =E2=80= =9880s anymore. >=20 > I use ALE with vim, which integrates with clangd via LSP and provides > autocompletion and error reporting for anything that can generate a > compile_commands.json. That=E2=80=99s not specific to C++. I wouldn=E2= =80=99t want > to write C without syntax highlighting, autocompletion, or live error > checking either. It=E2=80=99s possible to do so for C or C++, but you=E2= =80=99ll be > less productive. > > > A consequence of Microsoft's "Welcome back to C++" item that may > > have gotten missed is what resources are they spending to enforce > > compliance with a certain C++ standard? =20 >=20 > I have no idea what this means. =E2=80=98Compliance with a certain C++ > standard=E2=80=99 is a thing that your compiler tells you when you try to > compile. =20 >=20 > > Particularly, to enforce the restrictions on anti-patterns? =20 >=20 > That varies from project to project. I generally use clang-tidy and > clang-format in pre-merge hooks in CI for the projects that I worked > on at MS and that I work on personally. And, of course, code review. > Automated tooling is no substitute for code review. =20 > > > Cargo needs approximately a dozen lines in a > > configuration file to restrict its upstream sources. That includes > > whitespace and formatting. =20 >=20 >=20 > Here is the script that runs formatting and static analysis across a > codebase that I maintain: >=20 > https://github.com/microsoft/cheriot-rtos/blob/main/scripts/run_clang_tid= y_format.sh >=20 > Almost all of the complexity is in *not* running it on files that we > have imported from elsewhere or where, for compliance with external > standards, we don=E2=80=99t want to enforce our naming rules, and for fin= ding > the relevant toolchain files. The actual checker bit is right at the > end. >=20 > Most projects run this kind of check through their build system, but > we wanted to run it on headers in isolation as well as on full > compilation units. =20 >=20 > David >=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. 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. I have less reservations about C++ than I did earlier, though I think the build system may require major surgery to support it well.