4 ms·
Ah I didn’t recal ranged types in pascal. Granted my pascal experience was back in high school. I’m not too familiar with controlled or limited types, but it s
by elcritch 5y ago
Ah I didn’t recal ranged types in pascal. Granted my pascal experience was back in high school.
I’m not too familiar with controlled or limited types, but it seems the primary goal is control of resources. Nim’s compiler includes copy, sink, and destroy procedures for types [1]. The new ARC GC is deterministic, so you can ensure that once an object leaves the current scope it’s destructor will be invoked. It’s handy to cleanup C structs that are manually allocated by wrapping them in a Nim type. Makes C apis so much safer to use with minimal extra overhead.
1: https://nim-lang.org/docs/destructors.html https://nim-lang.org/docs/destructors.html