News for hackers. Stuff that matters.
Re:Introduction to ARC/ORC in Nim by rattray on Thursday October 15, 2020 @08:51AM (#24788047)
Interestingly, they claim yes – the homepage says this:

> Nim is a statically typed compiled systems programming language.

> Nim's memory management is deterministic and customizable with destructors and move semantics, inspired by C++ and Rust. It is well-suited for embedded, hard-realtime systems.

However, this article says that ORC, a non-deterministic and non-hard-realtime GC system, is likely to become the new default GC in the future.

Perhaps they found that the "systems language for hard-realtime" wasn't as compelling a value proposition as they originally thought?

Or perhaps the tradeoffs of ORC and availability of manual memory management give them confidence that it won't materially harm hard-realtime systems use-cases in practice?

Re:Introduction to ARC/ORC in Nim by arc776 on Thursday October 15, 2020 @09:34AM (#24788482)
> the tradeoffs of ORC and availability of manual memory management

For those not familiar with the language, Nim only uses GC for `seq` (dynamically sized lists like c++ vectors), `string`, and types declared with `ref`.

Everything else is a stack allocated value type, or as noted in the parent, you can manually manage with pointers.

> won't materially harm hard-realtime systems use-cases in practice

I think this is true. I already find myself rarely using GC when writing Nim, but when you want it, it's nice yet painless.

Here someone is embedding an async messagepack/JSON RPC on an ESP32: https://forum.nim-lang.org/t/6916

Later they compare no async, and ORC with async and find that it's "only a few ms slower than the RPC calls running with ARC and no async."

While this example may not be the hardest of realtime, it does show that ORC competes with manual approaches to memory management in constrained environments.

Re:Introduction to ARC/ORC in Nim by rattray on Thursday October 15, 2020 @10:14AM (#24788864)
Thank you! I'm not familiar with Nim beyond a few tutorials/docs, so this is very useful context.
Re:Introduction to ARC/ORC in Nim by Tiberium on Thursday October 15, 2020 @09:28AM (#24788401)
Even if ORC becomes the default no one stops you from using ARC which is 100% deterministic and hard-realtime.

ORC would be enough for most normal usages, and ARC is a switch away.