On 8/12/2016 12:29 PM, Shachar Shemesh wrote:
- No RAII support, despite the fact everybody here seems to think that D supports RAII.
Please explain.
- Recursive const makes many cases where I can use const in C++ (and enjoy the protection it provides) simply mutable in D.
Right, in C++ you can have a const pointer to mutable. On the other hand, in C++ you cannot have 'const T' apply to what is accessible through T.
- 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.
I don't understand this. Integral type promotions are the same as in C++. The casts are needed for integral type demotions (i.e. narrowing conversions). Having implicit narrowing conversions in C++ is a significant source of bugs, as the most significant bits are silently discarded.
- No warning for signed/unsigned comparisons. An unfailing source for bugs.
Understood, but to be pedantic, such warnings are extensions to C++ compilers, not part of the language.
- No ref type.
D has the ref storage class. What difference are you seeing?
