Am 14.06.2011 07:24, schrieb Nick Sabalausky: > "Petr Janda" <[email protected]> wrote in message > news:[email protected]... >> Hi, >> >> Can someone please explain what needs to be done (other than fixing >> the plethora of bugs) to call D2 final? And if someone can provide >> an approximate estimate of when? >> > > I already find D2, even with occasional bugs, to be *far* better than > dealing with C++. > > And no language is ever "final" unless it's a dead language. D2's already > ready for production use IMO, and many people are already using it > professionally. > >> uncertainty of how exactly will non-garbage >> collected classes work makes me a bit cautious.(could someone please >> explain too) >> > > Basically you can use either structs (which are not heap-allocated unless > you specifically ask for them to be) or you use "emplace". For emplace, you > allocate your own chunk of memory however you want, and then pass it to the > emplace function in Phobos which will construct your object right there "in > place" instead of allocating new GC'ed memory. Somebody else can explain the > details better than I can, I've never actually used emplace myself. >
Example of an custom (de)allocator for class-objects (using C malloc/free and emplace()): http://pastebin.com/9Qgf3vc7 Cheers, - Daniel
