On Fri, Apr 28, 2017 at 05:11:29PM -0400, Nick Sabalausky (Abscissa) via Digitalmars-d-announce wrote: > On 04/28/2017 04:26 PM, Atila Neves wrote: > > The other day I was reminded that in C++ land one has to manually > > write `operator<<` to print things out and `operator==` to compare > > things.
Not to mention you have to overload operator<, operator!=, operator==, operator>, operator<=, *and* operator>= in order to get the right results in all cases. In D, you have to overload opEquals and opCmp. Hmm, I wonder why I enjoy programming in D more than C++... > What, seriously?!? > > That's the thing about C++: The right way is the obscure way, and the > straightforward way is the wrong way. And yesterday's right way is > today's wrong way. And apparently (it would seem), the only way NOT to > completely fuck *everything* up is to become an expert on every corner > of the language, and STAY an expert on all the latest changes. In the > immortal words (and voice) of Duke Nukem: "What a mess!" Yep, this always reminds me of: https://bartoszmilewski.com/2013/09/19/edward-chands/ > Seriously, I don't care about the political incorrectness of bashing > or comparing to other languages, this right here is and always was D's > killer feature, the whole reason I got into it in the first place and > have stayed: D takes all the current (and former!) application domains > of C/C++, and brings to it basic programmer sanity. 'Nuff said. D is not without its own flaws and WAT-worthy dark corners, mind you, but in spite it its warts, I still prefer D any day over the masochistic labyrinth of 99 wrong ways to do the same thing (and only 1 "right" way -- until next year) that is C++. The latest WAT I found in D is this one, see if you can figure it out: char ch; wchar wch; dchar dch; pragma(msg, typeof(true ? ch : ch)); // char - OK pragma(msg, typeof(true ? ch : wch)); // int - WAT? pragma(msg, typeof(true ? wch : wch)); // wchar - OK pragma(msg, typeof(true ? wch : dch)); // uint - WAT? pragma(msg, typeof(true ? dch : dch)); // dchar - OK How an alternation between two character types ends up being int is beyond me, but even more inscrutible is why ch : wch produces int but wch : dch produces uint. See: https://issues.dlang.org/show_bug.cgi?id=17141 Unfortunately, my dmd-fu isn't up to snuff so my hamfisted PR to fix this problem didn't get very far: it broke a ton of stuff, which is a big no-no, oh noes, we cannot afford to break code, even though basically every dmd release breaks code! Oh well. T -- Those who've learned LaTeX swear by it. Those who are learning LaTeX swear at it. -- Pete Bleackley