A comparison of Rust's borrow checker to the one in C#

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • .NET Runtime

    .NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.

    "Vanilla" .NET runs on

    Operating Systems: Linux, macOS, Windows, FreeBSD, iOS, Android, Browser

    Architectures: x86, x86_64, ARMv6, ARMv7, ARMv8/ARM64, s390x, WASM

    Notes:

    Mono as referred here means https://github.com/dotnet/runtime/tree/main/src/mono which is an actively maintained runtime flavor, alongside CoreCLR.

    - application development targets on iOS and Android use Mono (the one that lives in dotnet/runtime). Android can be targeted as linux-bionic with regular CoreCLR, but it's pretty niche. iOS has experimental NativeAOT support but nothing set in stone yet, there are similar plans for Android too.

    - ARMv6 requires building runtime with Mono target. Bulding runtime is actually quite easy compared to other projects of similar size. There are community-published docker images for .NET 7 but I haven't seen any for .NET 8.

    - WASM also uses Mono for the time being. There is a NativeAOT-LLVM experiment which promises significant bundle size and performance improvements

    - For all the FreeBSD slander, .NET does a decent job in supporting it - it is listed in all sorts of OS enums, dotnet/runtime actively accepts patches to improve its support and there are contributions and considerations to ensure it does not break. It is present in https://www.freshports.org/lang/dotnet

    At the end of the day, I can run .NET on my router with OpenWRT or Raspberry Pi4 and all the laptops and desktops. This is already quite a good level given it's completely self-contained platform. It takes a lot of engineering effort to support everything.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • rust

    Empowering everyone to build reliable and efficient software.

    I think you're being overly optimistic in assuming that is actually the case. Bugs like https://bugs.llvm.org/show_bug.cgi?id=39282 make me think that even simple examples like you wrote could have had problems. Here's a similar bug but for GCC: https://github.com/rust-lang/rust/issues/54878#issuecomment-...

    I'm sure there were probably others.

    It's generally true that C/C++ code rarely if ever uses restrict & that Rust was the first to actually put any real pressure on those code paths and once it was found it took over a year to fix and it's incorrect to state that the miscompilation was only in code patterns that would only exist in Rust.

  • csharplang

    The official repo for the design of the C# programming language

    There is a runtime (not C#) feature that has been added that is relevant to the article: ref fields in structs. Before these, only certain runtime-blessed types like Span could contain refs directly.

    In case anyone is interested, here is the spec about refs in structs and other lifetime features mentioned in the article:

    https://github.com/dotnet/csharplang/blob/main/proposals/csh...

    And here is the big list of ways .NET differs from the publish ECMA spec. Some of these differences represent new runtime features.

    https://github.com/dotnet/runtime/blob/main/docs/design/spec...

  • dunet

    C# discriminated union source generator

    > The only grudge I have against them is they promised us discriminated unions since forever and they are still discussing how to implement it. I think that is the greatest feature C# is missing.

    To ease the wait you could try Dunet (discriminated union source generator).

    https://github.com/domn1995/dunet

  • rust-playground

    The Rust Playground

    Cool article!

    Quick nitpick: the find example could return a reference to a static variable, and thus avoid both the heavy syntax and the leaked allocation:

    https://play.rust-lang.org/?version=stable&mode=debug&editio...

  • project-anvil

    https://github.com/neon-sunset/project-anvil/blob/master/Sou...

    You might get better results by using snippets as the inspiration for rolling something tailored to your specific use-case.

  • Uno Platform

    Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!

  • Avalonia

    Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology

    you should checkout AvalonuiaUI[0] or unoPlatform[1] if wanting to target web/mobile/window/linux/macOS

    if building for the web online, asp.net core runs on Linux servers as well as windows

    and there's MAUI [2] ( not a fan of this), you are better-off with with the others.

    in summary c# and .NET is cross-platform, third party developers build better frameworks and tools for other platform while Microsoft prefers to develop for Microsoft ecosystem, if you get

    [0] https://avaloniaui.net/

  • dotnet

    This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.

  • CsWin32

    A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.

    I feel that nowadays Rust is the language to go when you are doing system programming, but C# is not a bad choice either. With .NET 9 being released in a few weeks we will get NativeAOT (compilation to a native single binary) for x86 (x64 and ARM64 are already available). At work, I'm writing patches for legacy apps and needed to use C++ for most of my tasks. Nowadays, I'm doing more and more stuff in C# and enjoying it. For WinAPI there is a fantastic cswin32 [1] project that generates FFIs signatures on the fly. And it's fairly simple to extend it for other Windows libraries (I did it for detours [2], for example). And using pointers or working with native memory blocks is straightforward and intuitive for people with C/C++ background.

    [1] https://github.com/microsoft/CsWin32

    [2] https://lowleveldesign.wordpress.com/2024/07/11/implementing...

  • Eto.Forms

    Cross platform GUI framework for desktop and mobile applications in .NET

    Besides the other GUI libraries people have mentioned, there is also Eto: https://github.com/picoe/Eto

  • UpsilonGC

    Custom Garbage Collectors for .NET Core

    It isn't trivial but it is supported. Here is an example [0] toy.

    I am not aware of any production grade replacement GCs for .NET out there currently

    https://github.com/kkokosa/UpsilonGC

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Microsoft donates the Mono Project to the Wine team

    30 projects | news.ycombinator.com | 27 Aug 2024
  • Ladybird browser to start using Swift language this fall

    10 projects | news.ycombinator.com | 10 Aug 2024
  • Generate your first Xamarin application with JHipster.NET

    3 projects | dev.to | 26 Feb 2021
  • Essential .NET Libraries Every Developer Should Know

    12 projects | dev.to | 8 Oct 2024
  • OpenRA: Open-Source Game Engine Reviving Classic Command and Conquer Titles

    1 project | news.ycombinator.com | 30 Sep 2024

Did you konow that C# is
the 9th most popular programming language
based on number of metions?