From nobody Sun Jan 21 17:29:12 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 4TJ0hb0SGlz57MBl for ; Sun, 21 Jan 2024 17:29:19 +0000 (UTC) (envelope-from ihor@antonovs.family) Received: from mail.antonovs.family (mail.antonovs.family [100.25.240.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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.antonovs.family", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TJ0hZ6zQBz4FVm; Sun, 21 Jan 2024 17:29:18 +0000 (UTC) (envelope-from ihor@antonovs.family) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antonovs.family; s=20200215; t=1705858154; 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=0ByZgNhsQiTgBGb/aAT3P06AHa5egRVVOqxGXy4btfo=; b=v3IweiGpAWYbNT+kLibkse09nZFw6glSpCcSlny+EDWTdgAUHsROaSRU7LCROAOuPwW6Gp FMpnE4Tin9hp4SybMUbk14iPLvgQ+0gYdHwIIoJ8o1suAenkwkvlKKYhxPS6CZJ1AHbTto 6f0EaC/b4hvJUnKXZBSQflNB06Pl0vY= Received: by mail.antonovs.family (OpenSMTPD) with ESMTPSA id 748323fa (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 21 Jan 2024 17:29:14 +0000 (UTC) Message-ID: Date: Sun, 21 Jan 2024 09:29:12 -0800 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 User-Agent: Mozilla Thunderbird Subject: Re: The Case for Rust (in the base system) Content-Language: en-US To: Alan Somers References: <1673801705774097@mail.yandex.ru> <202401210751.40L7pWEF011188@critter.freebsd.dk> <40bc1694-ee00-431b-866e-396e9d5c07a2@m5p.com> From: Ihor Antonov Cc: freebsd-hackers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4TJ0hZ6zQBz4FVm 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:14618, ipnet:100.24.0.0/13, country:US] On 1/21/24 08:04, Alan Somers wrote: > * Why Rust instead of Perl, Java, C#, or Go? I have more interesting questions: - What are we going to do when Mojo comes out? It is a compiled superset of python that will have a better borrow checker and is going to be suitable for low-level systems development? Chris Lattner  - they guy who wrote LLVM is building it, and he says Rust's approach is not the best. There will be a new hype wave. Productivity gains from mojo *will* outshine Rust. [1] - Are we going to add python/mojo to the codebase? - Are we going to remove Rust? - It is not about Rust per-se. How many more languages can we add to the src before it becomes  an unmaintainable mess? - What is our vision and policy about languages in src? [1] https://docs.modular.com/mojo/ > * Why not just use C++ then? > > Speaking from experience, I'm far more productive in Rust than C++ Same. But I'm afraid personal productivity comes at a cost of decreasing our collective productivity. Shifting mental gears from C to Rust is hard. It is much easier to shift from C to C++ (a reasonable subset thereof). Also - have we tried using C++ as if it is C? Read what PHK writes. We don't have to use all C++ features. We don't have to learn all of C++. I have a working prototype of C++23 codebase where I write C++ as C but with - methods on structs - namespaces - modules (C++20) No STL, no templates, none of the C++ insanity. This just makes a better C. Yes, I know that defining and maintaining a "sane" C++ subset is not trivial, but it seems to be like a much better way to evolve src. > * Rust will go out of fashion by the 2040s Yes, it is only the first systems language that has borrow checker and no GC. Mojo is coming. There will be more.. ... BTW, Someone mentioned Zig and I want to develop this idea further. Zig in base is actually not a crazy idea at all! I am currently playing with Zig and ZIg is great. - It mixes with C much better than Rust. - It can be bootstrapped from vanilla LLVM. - It has conservative mindset - much closer to C and Go rather than C++ and Rust. - Productivity gains are as great as in Rust, or bigger. - Zig foundation has not been (yet) overrun by corporate overlords. > [1] Yes I know about Modula-3, D, etc. But for various reasons those > never gained traction. > [2] Dumb pointers exist too, but they're almost never used except when > binding to a C library. > [3] https://github.com/lpabon/cmockery2/blob/master/doc/usage.md > [4] https://docs.rs/mockall/latest/mockall/ > -- Ihor Antonov