From nobody Mon Jan 22 23:33:44 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 4TJmkl3Vdhz58RLc for ; Mon, 22 Jan 2024 23:33:51 +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 4TJmkk3ckyz4jJT for ; Mon, 22 Jan 2024 23:33:50 +0000 (UTC) (envelope-from robert@rrbrussell.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=rrbrussell.com header.s=fm2 header.b=ffiiYMCY; dkim=pass header.d=messagingengine.com header.s=fm3 header.b="i 44yRuV"; dmarc=pass (policy=quarantine) header.from=rrbrussell.com; spf=pass (mx1.freebsd.org: domain of robert@rrbrussell.com designates 64.147.123.20 as permitted sender) smtp.mailfrom=robert@rrbrussell.com Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 86D2E3200A60 for ; Mon, 22 Jan 2024 18:33:49 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 22 Jan 2024 18:33:49 -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=1705966428; x=1706052828; bh=NEGzTFCe9qncLZx+MxV3EJ9fzfqoZ2FeWXDDHaTcLVs=; b= ffiiYMCY/zgDek5qVLErqE+9TnPhl0Rkn3Xg8QxzMUblbWXvs5w4giokuulbt7Iu dDeUEnMc/3FYV/Js14DH53Y7APjYH22HrPwyJUmj/tjLBNp1Pq1tRjdE5elr9mui fr+rvoLKDODTz2oIY61aGHsxpBOsxoaN1Ob7d4eYwQrEh+k6U97/VVEQDbqROMne d3nYOnZ3H8t0hMdDbsD2cGpg9J8d3Sxpb5/9EFomH/1zMBzX+klPhQzkxgewf1XG ul/1RuGDE5oVIdd23CQ5yyWTjX1pe489eWvd9Qu0L8UKPA3MWmZllINTzZmzy4cI 2tX91/bONIsSzl56FIgo2Q== 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=1705966428; x= 1706052828; bh=NEGzTFCe9qncLZx+MxV3EJ9fzfqoZ2FeWXDDHaTcLVs=; b=i 44yRuVWWJ5ImD1/q4/rdc8fIFlbXnZkokqyazhzC33YKW2eLV2tz7DyPmFL/u3Gf bn5wiAzvot3MFiu1xq7DqUWsI2Qwc+CFAhPFSPUqHtUYDF0jyHspMNtShaUp61r2 aRyT99mUTpVcXKt08Lir1OAfS5vSaANACxL02Sl3nfbvYVlKgeFc6JGr0mDEWY5p 9NWnmeQlZWIeHBZuhnRkpJoHEPMQFVW2G6sPoU6pYGgmNCp5/a7If0sc/CgjPMHD p4E6pCi9pttIsraDeP9uSd0mrW0yO1WsMVIskDIgaV5VYC/v4exufTmILZDC1f68 rKAR/dEV4w26Cq4hkkDUw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdekjedgtdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkjghfofggtgfgsehtje ertdertddvnecuhfhrohhmpedftfhosggvrhhtucftrdcutfhushhsvghllhdfuceorhho sggvrhhtsehrrhgsrhhushhsvghllhdrtghomheqnecuggftrfgrthhtvghrnhepudfhje eikeekkeeihefggeehhfejgeelvdelvddtteegveeffedvieffkedvtdfgnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosggvrhhtsehrrh gsrhhushhsvghllhdrtghomh X-ME-Proxy: Feedback-ID: ie421460a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 22 Jan 2024 18:33:47 -0500 (EST) Date: Mon, 22 Jan 2024 17:33:44 -0600 From: "Robert R. Russell" To: freebsd-hackers@freebsd.org Subject: Re: The Case for Rust (in the base system) Message-ID: <20240122173344.516be9d8@venus.private.rrbrussell.com> In-Reply-To: <202401220857.40M8vlHr099146@critter.freebsd.dk> References: <1673801705774097@mail.yandex.ru> <202401210751.40L7pWEF011188@critter.freebsd.dk> <20240121171403.6f167408@venus.private.rrbrussell.com> <202401220857.40M8vlHr099146@critter.freebsd.dk> 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=US-ASCII Content-Transfer-Encoding: 7bit X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.49 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[messagingengine.com:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.991]; DMARC_POLICY_ALLOW(-0.50)[rrbrussell.com,quarantine]; RWL_MAILSPIKE_EXCELLENT(-0.40)[64.147.123.20:from]; R_DKIM_ALLOW(-0.20)[rrbrussell.com:s=fm2,messagingengine.com:s=fm3]; R_SPF_ALLOW(-0.20)[+ip4:64.147.123.20]; RCVD_IN_DNSWL_LOW(-0.10)[64.147.123.20:from]; MIME_GOOD(-0.10)[text/plain]; DKIM_TRACE(0.00)[rrbrussell.com:+,messagingengine.com:+]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ASN(0.00)[asn:29838, ipnet:64.147.123.0/24, country:US]; ARC_NA(0.00)[]; TO_DN_NONE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[robert]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+] X-Rspamd-Queue-Id: 4TJmkk3ckyz4jJT On Mon, 22 Jan 2024 08:57:47 +0000 "Poul-Henning Kamp" wrote: > Robert R. Russell writes: > > > How do you define all the cool kids are doing it language versus I > > am assuming a serious language? I am not being sarcastic. > > That is a fair and valid question. > > My comment was not so much about the language itself, as about the > arguments tendered for why we should import it in FreeBSD. > > Let me fold that out, so we have it in the mail-archive for future > use: > > Rust has certainly been around for long enough to be taken seriously, > but so has FORTH, C++, Perl, Tcl, Modula-3, Haskell and Lua, all > of which have at one time or another, tried to wiggle their way > into FreeBSD-src, with very different outcomes. > > FORTH is still here, because the loader uses it. The loader used > to be incredibly size-constrained, so FORTH was almost the only > option we had, but that is much less of an issue now, and Lua is > eating into the loader, because one can actually read Lua code. (I > personally love FORTH, but RPN is not for everybody.) > > C++ is still here. It got in because it sort-of came for free > with GCC and we needed it for groff to read our manual pages. > These days groff is gone, but now CLANG uses C++, so it stays. > The maintenance load is very small compared to the load carried. > > Perl got in, and got thrown out again, when we saw how much pain > it caused. Partly because the situation with perl-modules where > very similar to what people say about Rust crates, but also because > the language was so rapidly evolving, that we would never be able > to ship an acceptably up to date version in our releases. > > As I remember it, Tcl never got in, despite me pushing heavily for > it, and today I will agree that Lua does the "embedded language" > thing much better. > > Modula-3 had one thing going for it: CVSUP, but even though that > was for the project what git(1) is for us today, that wasn't enough. > In fairness I should say that the maintenance would have been very > heavy because of the posix-incompatible threading. > > Haskell barely got any discussion, as I remember it, the arguments > were nowhere near credible. > > Lua had a strong use-case, came with a good proof-of-concept code and > a very small maintenance footprint. You literally cannot tell that > it isn't just "another library". > > To me Rust lands somewhere in the cursed triangle between C++, Perl > and Modula-3. > > Rust's rapid release-cycle means that we will have to deliver the > built-in Rust in such away that the users can install a newer Rust > from ports, or directly, without friction. > > As far as I can tell, Rust is no better prepared for that than Perl > was, and the Rust Crates equally not so, like the Perl Modules. At > the very least, that means serious maintenance work for us, and we > will probably still annoy the actual users of Rust. > > With Perl we ended up have a special magic "only for use in the > tree" Perl, and if people wanted to use Perl in any other way, they > had to install another Perl from ports. > > Then there is the "There's always a Crate for that..." attitude, > which we also saw with Perl: We received numerous "Perl in base > is useless unless we also import at least the following N Perl > Modules" for a very large union of Ns. > > Fundamentally there is a huge difference between importing a > programming language, which we have done successfully, and importing > an eco-system, which we tried once and ran screaming back. > > Even ports, which is laser-focused on 3rd-party software, is having > some impedance trouble with eco-systems. > > But it could still make sense for us, if we decide to go all-in, > the way for instance Mozilla has chosen to do: If most of userland > ended up being Rust programs, the amortized maintenance hazzle might > be worth it. > > But I dont see that happening: The testing and validation that we > got all (mis-)features to be (bug-)compatible would be an utter > waste of time, and who would care if paste(1) is written in C or > Rust anyway ? > > If we do not go all-in, Rust needs a "killer-application", and > as you have probably spotted already, my "rewrite CVSUP" was not > just a flippant thought: If CVSUP was not enought to get Modula-3 > over the line, Rust will have to do better. > > If people want Rust in FreeBSD, their first task is to show, with > actual code, how much better it would make FreeBSD, and I saw nothing > like that in the email thread, and thus the "all the cool kids use > it" summary. > > I know that we in the Varnish project love our "varnishtest" to > pieces, it has made us so much more productive, but I dont know > if a "freebsdtest" program, written in Rust or any other language, > would become the same kind of success. > > Poul-Henning > > PS: And to take this to it's logical conclusion: Apart from > tradition, I'm not sure I see why we have a C-compiler in the tree > anymore. Wouldn't everybody's life be easier if we just used > a compiler from ports ? > First thank you for the reasoned response. Second the project probably needs a discussion about the build system and can the compiler be moved to ports. I think that is off topic for this thread. Looking back at my own Rust code, We appear have come to similar conclusions about Crates.io value. SERDE in particular has become one dependency I try to avoid at all cost. Which I think leads to one of my big reasons for supporting Rust and something else that needs to be moved to its own thread, Text encoding issues. I think the project needs to follow OpenBSD's lead and deprecate non UTF-8 locales. While I personally can't read or write anything other than English and a few dozen words in Spanish, Portuguese, and French, I can find or create test input data that isn't in basic ASCII and test my string handling against such input. Assuming allowing things like French column names make sense. As a whole, including documentation, C and by extension C++ have an atrocious mess in this issue. Other than basic call examples which the manpages and other references cover well, the bigger best practices, which datatype to use, is it already in UTF-8 or not, either don't exist or are contradictory depending on the age of the reference. With Rust I can incorporate Unicode decoding errors into my basic error handling path and let the user know that they need to run iconv or similar on their data.