1. 28
  1.  

  2. 12

    I’ve used D a few times at work. In the end I had to abandoned it and moved towards rust.: D is a pleasure to work with and more ergonomic than C and C++ in my opinion, but the value proposition is not strong enough to move away from a strong tooling ecosystem, literature/documentation and a ton of amazing libraries. D marketed itself as a C/C++ replacement, but I felt given it having a GC that was always a tricky proposition. I always thought about it more of a much faster Python. In the end, it failed to built a sustainable ecosystem with strong library support around that made it difficult to work with. For work, I implemented a read-only fuse filesystem. It took my significantly longer in the end than writing it in C, due to missing libraries, maintaining libfuse binding, weird interactions between libfuse and the GC and compiler bugs in pre- and post-contracts. I love the language and really wanted it to succeed, but it was too costly for the value proposition of “just a better C/C++”. That being said, I do hope I see more D in the world. When it worked, I loved working with it.

    1. 8

      I started with D in late 2006 and it pretty quickly replaced all other programming languages (except when work required something else, which was on-and-off). It does have a big strength in familiarity with the same C-like syntax, but letting you expand in various directions incrementally. I replaced PHP for webdev with D just as easily as I replaced C with it and that’s super cool.

      I agree with the author on the skill gap though; the D leadership don’t really know how to manage or market, and I also feel like they just kinda chase trends instead of having their own vision. But this isn’t necessarily a bad thing - if they fail at marketing, that doesn’t affect me since I’m already here :) And chasing trends is frustrating in the short term, but long term it actually does help with its all-purpose character as the essence of the strong ideas survive while the other stuff just kinda gets forgotten. All the while, the traditional core stays pretty strong.

      Other people complain about libraries and garbage collection, but I see the GC as a major win (and D’s implementation is flexible enough for those cases where it doesn’t do as well), and I prefer to DIY so I ignore libraries anyway. So both features, not bugs :)

      Of course I’ve been using it so long now that I’ve built up my own decent little library system and just instinctively know how to avoid things that don’t work so well your mileage is likely to vary.

      1. 9

        I also feel like they just kinda chase trends instead of having their own vision.

        This is probably my second biggest gripe with D. Because they don’t have their own vision, or perhaps because they keep changing it, everything in D feels bolted on. Every time I start a function with @safe, or something similar, it feels like a janky afterthought.

        My biggest problem with D is the marketing. They need to stop pretending D is going to, is trying to, or even wants to, replace C or C++. I’m sorry Walter, but that ship sailed a decade or more ago. No matter how much people say it, anytime someone who writes C sees that D has GC, they will immediately rule it out. And the number of devs who won’t are negligible. Instead D should focus on what everyone says who tries it. “Wow! This is like a fast python.”

        D is a great language. Its fast, it feels natural to code in as a former VB, C#, and current python dev , and the development experience, IMO, is top notch. dub is really nice and puts a lot of languages (looking at you python) to shame.

        1. 1

          No matter how much people say it, anytime someone who writes C sees that D has GC, they will immediately rule it out.

          This does happen of course for decision-maker or high-level people, but D tend to attract “bottom-up” types that like to check facts for themselves (for better or worse). The most common path is that gradually people open up to the GC being a good idea as discovered by academia decades ago.

          1. 2

            I’m not going to argue with your claims, but the size of D community would suggest the number of “bottom-up” types attracted to D is minimal compared to other languages stealing mind-share from C/C++.

            1. 1

              Yes but this is still talking about popularity.

              Personally I care about whether I can do my job efficiently, correctly, have a fast result, a nice community etc. Does it build fast? Does it give me useless work day to day? I can verify these kind of low-level property. I can also verify that the community is growing http://erdani.com/d/downloads.daily.png So I’m not sure what problem D has really. practice vs theory

          2. 1

            D has lots of options when it comes to memory, including the @nogc annotation.

            1. 4

              I mean this in the nicest way possible, but …

              Your post is the exact response D enthusiasts always give, and IMO, it’s the wrong one. To quote myself, no one is going to switch to D after learning the “GC isn’t that bad” or the “GC can be tuned” or the “GC can be turned off”. They see GC and they leave.

              D needs to stop fighting with people who care about GC in their language and instead embrace the people who are okay with it. D is never going to convert people from C, C++, or rust. They have a real chance in my opinion of converting people who program in ruby or python or elixr though. The kinds of languages that D could actually compete with and win in a lot of categories.

              1. 2

                it’s the wrong one.

                Yeah, I’m inclined to agree. It bugs me to see people get the technical facts wrong but the fact is correcting them is just going down a distracted path. It is implicitly ceding that GC was a mistake and you should avoid it and that’s the wrong message.

                I like to call D an “all-purpose language”. It can do just about anything you want it to do, some things with more or less work than others, but virtually anything is possible. I’d rather emphasize that fact overall while keeping the focus on core strengths rather than letting online critics change the tone. We’re hurting ourselves by focusing on niche uses for new people. If you’re already a D user and want to apply your beloved language to the new niche, absolutely, let’s get into the details of when, where, and how to tweak/remove the GC or whatever else, I’m sure you’ll be pleased, maybe even elated that you don’t have to switch languages to explore this new area. We get 80% of the benefit with 20% of the pain thanks to still being the same language you know and love.

                But if you’re not already a D user and specifically focused on this niche area? You’re not going to see those benefits. You still get the pain of using a new language, add on the pain of using it an esoteric manner so there’s not as much established lore out there to help you… and for all that pain, you only get an 80% solution, when the other languages are promising 99%. As D marketers, we’re just setting everyone up for disappointment.

                When I switched to D, the two main things I started with, like I said in the other comment, were actually websites from PHP and little homemade games (and other assorted desktop app stuff) that I happened to write in C++ at the time, but could just as well have been done in just about any other language. (And actually, one of the things that put me over the edge was spending half a day trying to trace down a memory management issue in the C++. Turns out the memory was freed by the library but that wasn’t obvious… and I just felt it was wasted time figuring it out when a GC would have avoided the whole question. C++ has improved since then too, nowadays there’s better techniques to make it more obvious, but still, like why even bother messing with it in most cases?)

                So if I was the “D”ictator, I’d probably focus on some relatively boring, mainstream thing and compete against Python like you said, or maybe Java (D started life as basically a Java/C hybrid!), just with the tantalizing possibility of it being the last language you ever need to learn since it will grow and adapt with you as you expand your horizons. That’s the way I see it.

                But since I actually just use D every day instead of commenting on the internet (I say, in a comment on the Internet), I’m apparently not the target market. Alas.

          3. 3

            What libraries are you using for web development in D? I would love to give it a shot and just dabble around in some REST backends that don’t require much beyond session management and database connection (preferable to Postgres).

            1. 6

              What libraries are you using for web development in D?

              Wrote it all myself, lives in here: https://github.com/adamdruppe/arsd specifically the module cgi.d in there does the web serving (it also includes a http server if that’s your thing) and then database.d is a generic interface and postgres.d is a libpq implementation of that interface. You can ignore the other files in there if you don’t need them.

              cgi.d embeds its own little key/value store you can use for sessions on Linux - I never implemented these add-on features on Windows though (the core system works fine but the included session thing uses a linux-only addon server right now). And I have barely documented this at all since, again, I wrote it myself for myself and I just copy/paste out of my last project to get a new one started.

              But it looks something like this

              struct MySessionData {
                  int userId;
                 // and whatever
              }
              
              void myRequestHandler(Cgi cgi) {
                  auto session = cgi.getSessionObject!MySessionData;
                 // now normal assignment saves and loads from the other server
              }
              
              mixin GenericMain!myRequestHandler; // simplest way to get it going
              

              The cgi object has request/response methods see: http://dpldocs.info/arsd.cgi Basic functionality there actually based on PHP, then there’s far more advanced stuff on top like you can have it automatically wrap classes, generate HTML forms from parameters and html/json from return values. But I’ve documented that even less than the php-style basics. One of my public projects uses it: https://github.com/adamdruppe/dupdates/blob/master/main.d#L157

              And database is basically all

              auto db = new PostgreSql("dbname=whatever");
              foreach(row; db.query("select * from whatever where id = ?", x))
                  row["id"] or row[0] works. they are strings, you can convert to whatever else if needed
              

              again my goal was to migrate PHP when I originally wrote this and I found it good enough so happy.

              Aaaaanyway, like my stuff works for me, but no promises it will work for you especially given my partial (at best) documentation.

              The popular D web lib (they have much better marketing and more docs, bigger community around it) is this one: https://vibed.org/ but by the time that came out mine was already working for me for years so I don’t know a whole lot about it.

          4. 5

            I think that D lost most of it’s momentum during Tango/Phobos war. Later there was problem with GC in stdlib, so its usability was reduced in restricted environments. After that Rust and Go happened, and stole rest of the potential users.

            1. 3

              My only exposure to D is reading Tilix source code, but that little bit looks like a nice combination between C and python. It’s very read-able source code.

              1. 1

                Walter! we love you and thanks for making and continuing to make D.