3 ms·
Support for embedded is indeed getting into focus. I hope to release an article soon how the '--gc:regions' switch works (which is misnamed, it's a way to do me
by Araq 8y ago
Support for embedded is indeed getting into focus. I hope to release an article soon how the '--gc:regions' switch works (which is misnamed, it's a way to do memory management, not a GC...) and in the longer run the destructor-based runtime will ensure that memory is freed sooner than a GC would for memory constrained devices.
Having said that, "embedded" is a wide field and sometimes one cannot even afford a heap, no matter if garbage collected or managed manually. But even then Nim can be used, you still get array bounds checking, Ada-inspired strong type checking plus the meta programming goodies.
- eaurouge 8y agoGreat! My interest is in bare metal environments where you typically don't use a heap. I'm not familiar with the `--gc:regions` switch, but I think a good start could be a guide on how to implement simple non-garbage collected programs.
- snaky 8y agoThat's region-based memory management. ML guys tried it http://mlton.org/Regions http://mlton.org/Regions
- ptx 8y agoLooks like they concluded that having the compiler automatically choose an appropriate region but silently leak the memory when that fails doesn't work well? Kind of like GC by reference-counting without a cycle collector. Couldn't the compiler just reject code that would need to allocate in the global region, unless the programmer explicitly annotates it to make it global? It says the SML type system is too weak for this, but perhaps Nim's type system is sufficient?