Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because it's "optional". Some of D's features (https://dlang.org/spec/garbage.html#op_involving_gc) depend on it. It's optional in terms of you cannot use those. But if it's to never use them, why they even exist?


The GC is very nice for evaluating functions at compile time. It has zero runtime cost.


How would one go about instantiating an object in D without GC if the new keyword relies on it.

Accounting for memory allocation and object initialization (construction etc)?

Legit question coming from a D enjoyer


The compile time function execution enables allocation with `new` and it handles initialization, etc.


Thanks Walter!




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

Search: