On 12/08/16 17:50, mùsdl wrote:
On Friday, 12 August 2016 at 14:41:14 UTC, Shachar Shemesh wrote:
I cannot say the same thing about the things in C++ I miss when I
write D.
Be constructive and enumerate them.
I'll give some highlights, but those are, mostly, things that I've
already listed in this forum and in my lightening talk.
- No RAII support, despite the fact everybody here seems to think that D
supports RAII.
- Recursive const makes many cases where I can use const in C++ (and
enjoy the protection it provides) simply mutable in D.
- This one I have not complained about yet. Operator overloads stepping
on each other's toes. In my case, I have a container (with opIndex that
accepts a custom type and opOpAssign!"~") and I place in it a struct
with some operator overloads as well (have not reduced the cause yet,
hence no previous complaint about this one). So, when I write
Container[IndexType] ~= Type;
And the compiler assumes that means:
Container.opIndexOpAssign!"~"(IndexType, Type);
but since nothing like that is defined, the code doesn't compile. I
ended up writing (actual code from the Weka code base):
blockIds[diskIdx].opOpAssign!"~"(makeBlockId(stripeIdx+i,
placement.to!SlotIdx(diskIdx)));
Took me almost ten minutes and consulting someone else to find this
solution.
- GC. GC. GC. Some more GC.
- Integral type operations promotion and the constant need for casts.
- No warning for signed/unsigned comparisons. An unfailing source for bugs.
- No ref type.
These are just off the top of my head. There are more. Like I said, my
frustrations with D are daily.
Shachar