7 ms·
Why hasn't D started to replace C++
- grawprog 9y agoI like D. I learned all the things in D I could never really understand when I tried to learn about them in C and C++. Things like pointers, structs, unions the different sizes of types and other things. It's the first language that really made me appreciate why static typing and memory management are useful and why you can do things in a lower level language you can't do in a higher level one. But i also found the syntax fairly easy to pick up, I could never really wrap my head around C++'s weirdness, and my little bit of C knowledge made it fairly easy to begin learning more complicated aspects of the language. I have to admit some parts of it confuse me a bit. I still don't fully understand Templates and ranges but i've used them a little bit and can see why they're useful. I like the dub build system and code repository and definitely prefer imports to #include. As far as a lack of ide's goes. There isn't many. I like dlang ide. It has everything I need, though it can be kind of buggy. I also don't mind Vim with dlang plugins. But I don't think they can compare to large established ides for other languages. I can also understand why it doesn't really pick up for large projects the way c++ is. There isn't much in the way of libraries, there is no tutorials or help aimed towards beginner programmers, which is too bad because I think D is way better for beginners than Java or C, it teaches the same important concepts as both languages while providing a fairly strict compile time checking and a far less ridiculous syntax than java. With the option to not have to learn OOP stuff until you understand basic programming. It also makes it a lot harder to shoot yourself in the face the way C does. The standard library docs and most other documentation I've seen for D is fairly technical and not very inviting even for non beginners. Most libraries have little to no documentation and many haven't been maintained. The only real, understandable learning resource I could find is: http://ddili.org/ders/d.en/ http://ddili.org/ders/d.en/ Which is a great book, but also nearly the only readily available one to learn from. It is too bad because there are definitely lots of benefits to C++ it's just they're not quite worth the tradeoffs.
- earenndil 9y ago> I think D is way better for beginners than Java or C I love D but tbh I disagree. I think an optimal-ish progression for learning programming languages is: Python (basic programming&computer knowledge, algorithms) -> C (low-level knowledge) -> ASM (optional, only if you want to learn extra low level knowledge) -> C++ or Java (to learn modern OOP concepts. D's are a bit too complex and the error messages aren't as good and thus off-putting to a beginner) -> D (amazeballs metaprogramming) -> LISP (amazeballs metaprogramming and FP) Neither C, D, nor Java should be beginner languages. They're too big and fancy. (To be fair, python does this too, but it does a bit better job of hiding it, and exposes an api that can be leveraged to teach people programming even if they don't understand how it works.)
- grawprog 9y agoOk maybe not beginner. I was thinking more of a second or third language I suppose. I'm mostly self taught other than some BASIC classes in highschool and a bit of R for statistics in university. I never really understood most of the concepts of programming from that. I've tried to learn a bunch of languages on my own. For some reason I tried to start with perl and around the same time C....I wrote a few things but I got stuck on structs with C and well...perl...with perl so I gave up on those. I tried python and couldn't stand it. Tried c++ and D1 and got about as far as I did with C. At the same time I was reading general programming books and looking at lisp and scheme like they used in the books but I just didn't understand them at all...but I sort of understood the idea of functional programming and had understood enough of C to get how cool it was to be able to have fumctions return other functions and the ability to have anonymous functions. In the end I ended up learning lua as my first real language where I finally knew how to use programming to make things. I experimented with a few functional programs in lua and learned enough about OOP and luas metaprogramming to design my own classes and start working on some small games and bigger projects. Eventually I started to run into lua's limitations (every number is a floating point number, the classes I designed couldn't be serialized properly, there wasn't really a way to debug a lua program, lua's tables and metatables are kind of weird) and most of the answers I looked at pointed to needing to understand C and use lua's c bridge to get the kind of functionality I wanted from lua. That was when I rediscovered D and all the things that confused me about it before just made sense this time. I have been also trying to learn C along side it just because it seems like it's something I should know. But I've been writing most of my stuff in D lately, even smaller programs just because I find it has the balance between lower level and higher level stuff I need and can use for what I know.
- aey 9y agoIt was closed source when it was gaining mindshare. So they missed the boat
- dingo_bat 9y agoMost times the reason people switch from thing A to thing B is because they have a problem with A. Nobody has a problem with C++. Talk to any C++ dev, they love their job.
- tzhenghao 9y agoNot to mention that there’s huge C++ codebases out there (gaming, financial industries etc.) Great C++ skills will still be in demand for quite a while. Trying to ramp up new developers on a new, “too-bleeding edge” language/framework is too expensive. D markets themselves too hard on the C++ crowd, whereas languages like Rust and Go market themselves well outside the C++ circle to bring those devs closer to something that they can use as part of a performant service imo. I like D, but I think the two other languages stole the spotlight here.
- jstewartmobile 9y agoA long time ago, I did C++ dev for about 5 years. Absolutely hated it. Part of that could have been that it was C++ for Windows, but even so... Slow compile times, a sea of compiler options, pragmas, swamps of macros and templates, and the complete lack of understanding among coworkers of OO concepts like virtual functions or inheritance. Can totally sympathize with Linus' contempt for C++. edit: Notice dingo_bat is getting downvoted on this. How about responding with why you dislike C++ instead of the downvote?
- thesmallestcat 9y agoBut C doesn't have virtual functions or inheritance either.
- jstewartmobile 9y agoWhich isn't that much of a problem. When that approach is truly called for, you can fake it well enough in C with function pointers and macros. I know that isn't easy. If it makes you think first, sometimes "not easy" is a net positive. With "easy" OOP, the typical result was a wad of tightly-coupled classes that were difficult to enhance or reuse. C++ jammed so many different concepts into the built-ins, catering to all yet pleasing none. Last I checked, exceptions were still kind of a mess. Places I know that still use it have their own peculiar commandments as to what is halal and what is haraam. I do not blame them.
- deleted 9y ago[deleted]
- Someone1234 9y agoI believe a related question to ask is: How many new projects are started in that niche? C still seems to spawn new software because people are working directly with hardware and don't wish to code using straight assembly. I'm thinking computer engineering related fields. Robotics for example. C++ falls into an uncanny valley, it is neither high level language with all of the benefits (e.g. programmer efficiency, certain security guarantees, lower barrier to entry) or a completely low level language (or at least it isn't if you want to benefit from most of C++'s advantages over straight C; you'll avoid a garbage collector but not a lot of "magic" behind the scenes). C++ carved out a space with 3D gaming for a while but with many development houses moving to licensed game engines or targeting mobile platforms C++'s benefit may be waning. The data does support this supposition[0]. [0] https://www.tiobe.com/tiobe-index/cplusplus/ https://www.tiobe.com/tiobe-index/cplusplus/
- bitL 9y agoAdvanced robotics is utterly dominated by C++.
- fooker 9y agoAdvanced everything is utterly dominated by C++.
- AstralStorm 9y agoNot lower bit microcontroller programming which is still dominated by C. (Because C++ compilers do not exist or produce worse code.)
- fooker 9y ago>Because C++ compilers do not exist or produce worse code. I am surprised this is still true in 2018. GCC and Clang on x86 with -fno-rtti and -fno-exceptions produce almost identical code for similar programs in C and C++. If what you say is true, I suppose there aren't enough compiler devs paid to optimize C++ for those platforms.
- systems 9y agoi think the best hope for D is not to replace any language, or dominate any domain but to be a player there will always be systems written in different languages for different reasons, or for small advantages of one language over the other there is a place for C# and Java , a place for rust and go, a place for F# and Clojure, a place for Pythong and Tcl/Tk, etc .. D from the little i know of it, is a nice language, I dont think it will ever dominate anything or replace anything .. but it definitely has a place .. or deserves to have a place
- jstewartmobile 9y agoFrom what I'm seeing on GitHub, Rust has beaten it to the punch, mightily. Levien's Xi video today being yet another example. edit: As for why, languages are more of a battleground than a substrate. If you have a choice between Swift (Apple), Rust (Mozilla), Go (Google), or D (Walter Bright), most people are going to flock to one of the bigger forces. Golang is a kind-of underwhelming riff on Pascal, but I use it anyway for network stuff. Why? Google has given it an instant ecosystem with plenty of well tested libraries, docs, and howtos. Never underestimate the ecosystem.
- flukus 9y agoIn lieu of a mega corporation behind you, having a killer app to get people interested seems valuable. Ruby would still be niche without rails for instance, .net would have been an uninspiring java clone without MS RAD tools. You can't just have a good language, you need to show the world that it can be used to build good software.
- jstewartmobile 9y agoI'm really impressed with the Clojure community. They have done a great job sans-megacorp.
- dropit_sphere 9y agoIt helps to have a good language to attract those people.
- megaman22 9y agoD looked cool when I was struggling to learn C++, and got a little bit of buzz on some sites I was active on, like gamedev.net. That was 12-15 years ago. I'm just not sure that middle ground between C++ and Java/C# is terribly compelling, and has also been swamped by later entries like Rust, Swift, and Go, which additionally have major backers.
- icholy 9y agoIt's not a big enough improvement over C++ to warrant switching.
- harry8 9y agolegal D: if(foo) bar(); baz(); A language design bug copied from C. A feature that is good only to add a class of bugs to programs in your language with zero benfit. Perl wasn't tasteless enough to copy that. D designers were, does that convince you they have the right taste to design your systems language? Alexandrescou is exactly the kind of C++ person D is designed for (and now by). Is the code more important or the data transformation being performed by that code? Garbage collection, same as golang with the same perception that it's a replacement for java/python/ruby/perl not C nor C++ - this will be the perception and they will say "yeah but ..." sure, but that perception is not devoid of merit. "You don't need ..." nup, as an engineer I decide that, I don't want it imposed. Low level access to raw hardware, zero cost convenient abstractions, no runtime cost imposed by the language, consistent, easy to get right (or at least harder to get wrong, less gotchas). Whatever replaces C & C++ will tick those boxes unless hardware changes dramatically. People believe that D doesn't. Then there's just practical stuff like using facebook's linter - well you can't, it just doesn't work. https://github.com/facebookarchive/flint https://github.com/facebookarchive/flint Is the D version even there? Too hard, too alpha, the overhead of a new language needs more to sell it. I haven't yet programmed a line of Rust or Go but both look more compelling.
- bitL 9y agoFacebook uses D internally.
- nitwit005 9y agoBecause everyone who could make that change already switched to Java, Python, and other options instead.
- dpc_pw 9y agoGC, no bigger-player backing, backend was propriety for a long while, and till fairly recently it wasn't a community project, but a one-man work. D is generally a much better Go (especially if you add fibres to it), but it doesn't have Google-brand behind it, so Go ate it's lunch in distributed systems space, while Rust is much better suited to be a serious competition to C++.
- soulbadguy 9y ago> Rust is much better suited to be a serious competition why ?
- kbart 9y agoPerformance and memory control -- these are the main reasons why people choose C/C++ nowadays and Rust tries to fit in as well. D, as stated in article, is more of Java competitor than C++, because it's slow and use GC.
- WalterBright 9y agoIf you use LDC or GDC, the code generation for D is the same as for C and C++, if the code is written the same way. The code generation for DMD has fallen a bit behind, mostly because I spend my time on other issues these days :-(
- atilaneves 9y agoD uses the GC by default - it's not required. As for speed, it's the same as C++.
- EvenThisAcronym 9y ago>because it's slow Where do people get this from? D compiles down to the same machine code that every other compiled language does and it has similar language semantics to C++. In some cases D is _faster_ because its richer type and effect systems allow for more opportunities for optimization.
- 9y ago
- person77 9y agoCpp was my first language. It seems like I choose languages based upon the project, and it along with Java or JS or python tend to be what's needed for my interests. I guess to me it is simply a tool. So if some killer tech preferred D, then I would pick it up probably. I do avoid many Cpp features, I am just working with a subset usually, for better or worse.
- potbelly83 9y agoSerious question, if you were going to replace C++, why choose D over something like Ada?
- p0nce 9y agoWithout going into the language details: it seems there is only one open-source free compiler for Ada, while there are three for D.