Hacker News new | ask | show | jobs
by tarwich 234 days ago
I would assume not. Consider ARC vs GC. With ARC the programmer manages memory and with GC the compiler manages it. People choose one or the other because of the style they're going after. Could you set a flag for it. Maybe if all libraries you download were pre-compiled perhaps.

Personally, I just prefer to know that the team that supports the tool I'm using is dedicated to "that one thing" I'm after.

3 comments

You could do it. You could allocate something as garbage-collectible or not at allocation time. You probably would want them to be different types, though, so that the type system keeps track of whether you need to manually deallocate this particular thing, or whether the garbage collector will do so.

It could be done... but I'm not sure what it would gain you. It seems to me that knowing that it will do one or the other is better than having to think about which it will do in each instance.

Nim language iirc can have either of arc or gc and even manual etc. via their Multi-paradigm Memory Management Strategies Source: https://nim-lang.org/1.4.0/gc.html
Huh?

ARC stands for Automatic Reference Counting. The compiler manages the reference counts.

They may have been thinking rust where it means atomic reference counting.

(Although the compiler inserts ref count inc and dec calls automatically, so ...)