News for hackers. Stuff that matters.
Re:Rust in Linux kernel is just a beginning by goodpoint on Tuesday October 25, 2022 @04:54AM (#33327955)
That's outdated information from 2016. Now Nim uses ARC/ORC. ARC implements memory management at compile time like Rust and it's still very fast at compiling.
Re:Rust in Linux kernel is just a beginning by codewithcheese on Tuesday October 25, 2022 @05:28AM (#33328228)
Cool, I wasn't aware, thanks. https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc...

> The main difference between ARC and Nim GCs is that ARC is fully deterministic - the compiler automatically injects destructors when it deems that some variable (a string, sequence, reference, or something else) is no longer needed. In this sense, it’s similar to C++ with its destructors (RAII). To illustrate, we can use Nim’s expandArc introspection (will be available in Nim 1.4).

> This shows one of the main ARC features: scope-based memory management. A scope is a separate region of code in the program. Scope-based MM means that the compiler will automatically insert destructor calls for any variables which need a destructor after the scope ends. Many Nim constructs introduce new scopes: procs, funcs, converters, methods, block statements and expressions, for and while loops, etc.

> ARC also has so-called hooks - special procedures that can be defined for types to override the default compiler behaviour when destroying/moving/copying the variable. These are particularly useful when you want to make custom semantics for your types, deal with low-level operations involving pointers, or do FFI.

Re:Rust in Linux kernel is just a beginning by fithisux on Tuesday October 25, 2022 @07:00AM (#33328871)
Really. I did not know that. so, can I use today Nim but with a Rust-like ARC?
Re:Rust in Linux kernel is just a beginning by cb321 on Tuesday October 25, 2022 @08:30AM (#33329613)
--gc:arc/--mm:arc has been around for a couple years (as per that blog post link) and fairly stable for >1 year. It is slated to become the default automatic memory management strategy in Nim-2.0. The hope is to release 2.0 this year.

You can always make it your own personal default with older versions (e.g. nim-1.6), by editing your $HOME/.config/nim/nim.cfg to say so or doing similar on per project/file basis.

Re:Rust in Linux kernel is just a beginning by steveklabnik on Tuesday October 25, 2022 @02:20PM (#33334280)
Rust doesn't have ARC like Nim or Swift. (And Nim and Swift's are a bit different here but closer to each other than anything that exists in Rust.)