Are D classes always garbage collected?

Froglegs lugtug at gmail.com
Wed Dec 21 19:49:58 PST 2011


> You can allocate classes anywhere, if you're OK with forfeiting 
> safety guarantees. For example, see emplace in std.conv:
>
> http://dlang.org/phobos/std_conv.html#emplace

Ah thanks


> Value type polymorphism has shown to be problematic. One 
> notable problem is object slicing:
>
> http://en.wikipedia.org/wiki/Object_slicing

I see... seems like a pretty weak reason, I've never found that 
to be an issue in C++ as it is exactly what I'd expect to happen 
if I did something like that.


> I *think* the language allows implementing something akin to 
> value type polymorphism (sans syntax sugar), but currently the 
> required compiler features (alias this, compile-time 
> symbol/address evaluation) are not implemented well-enough to 
> test my idea.

Ah, faking it, hopefully that works out someday :)




More information about the Digitalmars-d-learn mailing list