←back to thread

13 points northlondoner | 1 comments | | HN request time: 0.218s | source

Noticed how C# is underrated. About memory safety in C#. How difficult to introduce multi-paradigm memory safety approach like Rust? Ownership model for example, would it be possible to enforce practice via some-sort of meta framework?
1. jasonthorsness ◴[] No.46290498[source]
C#'s runtime (dotnet runtime) adds overhead compared to Rust with GC and other stuff too. This is true even with single-binary AOT compilation, the runtime is still there (just like Go). So it will never be suitable for some scenarios.

You can definitely implement manual ownership tracking in C#, this is quite common for non-memory resources and does have some language syntactic sugar with the Dispose pattern for example. But you can't truly roll your own memory management/ownership unless you do something with "unsafe" which seems counter-productive in this case :P.