Hacker News new | past | comments | ask | show | jobs | submit login

So the garbage collection is optional? That's cool.



Sorta... many types have a more strongly enforced ownership style lifetime scope, but depending on the data you are declaring, the collector may come into action automatically.

Basically, Rust makes it easy to avoid the collector by clear ownership rules, but still provides a collector for the cases where that just won't do.


In previous threads (can't remember if it was here or on reddit), Rust developers noted that Rust currently needs a GC for many things, but part of the Region works is aimed at removing that need (aka unless the efforts fail, you should be able to use Rust 1.0 sans GC)


Rust actually doesn't have tracing GC; it instead uses reference counting and cycle collection. The major things that have stopped us from tracing GC so far are LLVM issues; I'm working on those now and we'd like to introduce optional tracing GC soon.

My personal thinking is that the standard libraries should avoid the GC and use regions, reference counting should be achievable through a "smart pointer" type in the standard library, and GC should be provided if the programmer wants it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: