4 ms·
Isn’t reference counting the obvious implementation? A garbage collector would only free cyclical references
by glouwbug 5y ago
Isn’t reference counting the obvious implementation? A garbage collector would only free cyclical references
- imtringued 5y agoIt would be more obvious to have a basic toolkit to let everyone build their own GC with LLVM. From my experience with building my own GC. There are only two challenges. Stack unwinding to obtain root references and then the GC strategy (generational GC, mark and sweep, etc). For most people, reimplementing the latter is a waste of their time.
- tinco 5y agoIt's only the obvious solution in the sense that it's not really a solution but it comes close enough that memory often doesn't leak fast enough for it to matter for short running programs. A drop in garbage collector (like Boehm) makes your toy language instantly production ready. Basically code generation and garbage collection are the two things that make language implementation tedious. That's why so many languages are on top of Java or .Net. Implementing a language on those platforms is almost trivial because it solves both code generation and garbage collection.