News for hackers. Stuff that matters.
Re:Pointer Free Programming and the Future of Nim by mratsim on Friday October 20, 2017 @06:57AM (#15514815)
I'd like to add that "circumventing the GC" is supported by default. There are 3 object types in Nim

- `type Foo = object` --> Value type, on the stack

- `type Foo = ref object` --> Reference type, managed by GC

- `type Foo = ptr object` --> Pointer type, manual memory management (with Nim's equivalent for malloc, free and memcopy)

Also Nim does not have 1 GC but several:

- Default Deferred Reference Counting - Not stop the world

- Boehm GC

- Mark and Sweep

- Memory Regions

- Real-time GC (with tunable max-pause)

- GC disabled

GC can also be deactivated per thread (setupForeignThreadGc) or for a section of the code (GC_ref, GC_unref) even on Ref types to improve interoperability with other languages.

There are no comments on this comment yet.