Nim: Rephrase "Garbage Collection" on website and documentation

Created on 4 Feb 2020  路  6Comments  路  Source: nim-lang/Nim

Problem: people on online forums frequently dismiss Nim as being garbage collected and unfit for games and microcontrollers, often assuming it is implementing a stop-the-world gc. example

Proposed solution: 1) describe the memory management as multi-paradigm on https://nim-lang.org/ and link to https://nim-lang.org/features.html and https://nim-lang.org/docs/gc.html
2) clarify that the current GC implementation is not Java-like stop-the-world

Update https://nim-lang.org/docs/gc.html with a list of the existing memory managers and hint at the upcoming ARC

Documentation Hacktoberfest good first issue

Most helpful comment

As an anecdote, one of the big things that drew me to Nim was that it has a GC. I wanted a compiled language that had automatic memory management and didn't look like the top row of my keyboard had been stepped on by a cat.

All 6 comments

Maybe also deprecate --gc: to rename it to --mm: for memory management. Instead of gc.html have mm.html that starts with "Nim's Memory Management" and list other GCs as one of Memory Management Modes along with none and arc...

Describe arc as not as a "GC" but a cleaver compiler trick that figures out statically where allocations and frees go ... and in rare cases where a logic is too complex it falls back on reference counting ... but it still stays extremely deterministic and fast.

In even rare case in very complex code where cycles are possible, you can use a cycle detector called --mm:orc. But only if you choose/require it for your use case.

But maybe this is going too far... and would scare people way from GC based languages that want safety of the GC?

But maybe this is going too far... and would scare people way from GC based languages that want safety of the GC?

Yes

Describe arc as not as a "GC" but a cleaver compiler trick that figures out statically where allocations and frees go

The thing is, in general it cannot. The information is just not there. Rust can do it at the price of making the type system much more complicated. Let us not sell what is not there

The thing is, in general it cannot. The information is just not there. Rust can do it at the price of making the type system much more complicated. Let us not sell what is not there

Nah, Rust cannot do it either, in Rust too it's mostly a marketing gag. It uses 1 bit reference counts under the hood, for example.

It uses 1 bit reference counts under the hood, for example.

Wow, I did not know that! Do you have a reference?

As an anecdote, one of the big things that drew me to Nim was that it has a GC. I wanted a compiled language that had automatic memory management and didn't look like the top row of my keyboard had been stepped on by a cat.

Was this page helpful?
0 / 5 - 0 ratings