[OT] Previously: DMD - Windows -> C# in gamedev

Nick Sabalausky a at a.a
Sun Jan 8 13:13:26 PST 2012


"Manu" <turkeyman at gmail.com> wrote in message 
news:mailman.198.1326020770.16222.digitalmars-d at puremagic.com...
>
> I tend to think D is considerably less simple than C,

Except for the lack of dealing with headers and preprocessor. And D has a 
lot of other nicities that do make it simpler to use, like slicing and 
numbers with underscore separators.

> possibly more complex
> (but less archaic) than C++... It's not really something you could expose
> to a designer.
>

I'd expose D to a designer long before I'd expose them to C. C's too 
low-level and, a bit anachronistic in some ways (like headers).

Although, this is one thing I have to agree with Carmack on: Non-programmers 
have no business writing production code anyway.

>
> D:
> MyObject obj = new MyObject(x, y, z);
>
> D (subverting GC):
> MyObject* obj = (MyObject*)someManager.Alloc(MyObject.sizeof);
> ....?

More likely something closer to this:

MyObject obj = fooAlloc!MyObject(x, y, z);

Or, of course:

auto obj = fooAlloc!MyObject(x, y, z);

> how do I even perform a placement new?
>

emplace: http://www.d-programming-language.org/phobos/std_conv.html

auto obj = emplace!MyObject(pointerOrVoidArray, x, y, z);

> I wouldn't want to be doing that everywhere.
> If D implements allocators, then I can see that being much better, 
> enabling
> one to still write fairly conventional D code.
>




More information about the Digitalmars-d mailing list