Hacker News new | ask | show | jobs
by gizmo686 247 days ago
Also, the proposed garbage collector is still opt in. Only pointers that are specifically marked as GC are garbage collected. This means that most references are still cleaned up automatically when the owner goes out of scope. This greatly reduces the cost of GC compared to making all heap allocations garbage collected.

This isn't even a new concept in Rust. Rust already has a well accepted RC<T> type for reference counted pointers. From a usage perspective, GC<T> seems to fit in the same pattern.

1 comments

Language where most of the libraries are without GC, but has an GC opt in would be interesting. For example only your business logic code would use GC (so you can write it more quickly). And parts where you don't want GC are still written in the same language, avoiding the complexity of FFI.

Add opt-in development compilation JIT for quick iteration and you don't need any other language. (Except for user scripts where needed.)

The D programming language has an optional garbage collector. [0][1]

With the @nogc attribute the compiler can check/enforce that your function doesn't depend on the GC. [2]

[0] https://dlang.org/spec/garbage.html

[1] https://news.ycombinator.com/item?id=33382159

[2] https://dlang.org/spec/function.html#nogc-functions